611 questions
5
votes
3
answers
768
views
Return from void function
Suppose a class exists as follows:
class Foo
{
void do_after_something()
{
//some code here
return;
}
void do_something()
{
//some code here
return ...
-2
votes
4
answers
196
views
Why in java there is no reset option for variables [closed]
Sometime when we declare and initialize a variable, say we have an int i =10; then after some code this variable would be modified like this code bellow
public class reset {
public static void ...
2
votes
4
answers
2k
views
Can't execute feature in cucumber jvm
I am very new to using cucumber (started today).
It seems simple enough but I am having issues running a basic feature.
Feature: Proof of concept that my framework works
Scenario: My first test
...
26
votes
3
answers
27k
views
C# Null propagating operator / Conditional access expression & if blocks
The Null propagating operator / Conditional access expression coming in c#-6.0 looks like quite a handy feature. But I'm curious if it will help solve the problem of checking if a child member is not ...
3
votes
1
answer
2k
views
Will Hack language support function-overloading polymorphism?
I was trying to figure out how to implement a Visitor pattern in Hack. It obviously requires function-overloading polymorhism, but as I have tested, this examle:
<?hh // strict
class Visitor {
...
0
votes
2
answers
151
views
Explain this list comprehension oddity in the general case and what are it's use cases?
Yep. This happend. When I absent mindedly put an index on a in variable. Explain (it?) away.
What is happening in the general case and what are it's use cases?
>>> [q for q[0] in [range(10),...
0
votes
2
answers
261
views
Java Inheritance & OOP & AOP
This is actually a semi-question, semi-discussion thread.
I think a feature is needed in Java that a method(lets say "calcTotalX") can be defined via annotation in a class(i.e. ParallelExecuter) ...
2
votes
1
answer
847
views
Class Member Access on Instantiation
In PHP 5.4, I believe something like this is valid:
echo ( new DateTime( '2014-04-05 10:36am' ))->format( 'Y-m-d g:ia' );
On PHP 5.3, I currently do something like this:
$date = new DateTime( '...
1
vote
2
answers
71
views
What is this feature called and where is it documented? Dynamic object lookup?
I'm looking for more information about the PHP feature that looks like:
$obj->{$prop};
$obj->{$method}();
What is it called? Is it documented? Where?
Edit:
To clarify - I'm asking about the ...
0
votes
1
answer
77
views
Resizing Arrays for Speed
So, I am writing a Befunge Interpreter in Java. I have almost all of it down, except I can't figure out a good solution to the problem of Funge Space. Currently I'm using the style stated in the ...
0
votes
1
answer
356
views
Why can constexpr not apply to constructors?
Why can constexpr not apply to constructors?
The following code cannot be compiled with VC++ 2013 CTP.
struct A
{
constexpr A()
: _n(5)
{}
int _n;
};
constexpr A f()
{
...
11
votes
3
answers
958
views
Are move semantics incomplete?
Move semantics replace copy semantics in situations where copying is inefficient. Copy semantics deals fully with copyable objects, including const objects.
Already, there exists a myriad of non-...
3
votes
4
answers
684
views
Why can't a reference's target object be reasigned?
If I understand correctly, the motivation of references was to make it easier and cleaner to work "by reference" without having to bother with pointer dereferencing. But they are constant in nature, ...
0
votes
1
answer
662
views
urdu language support in ios applications
i want to make an application that contains collection of text but in URDU language, i'm confused how to implement it . I've read many posts regarding this but couldn't come to a relevant answer. ...
0
votes
1
answer
883
views
Are async/await keywords only usable with VS 2012+?
Are async/await keywords only usable with VS 2012+ and not usable with the C# compiler, which I could use from command line?
I've read some questions at SO, like:
Will VS 2010 allow me to use the ...
7
votes
2
answers
2k
views
Java Upside Down Text - Bug or Feature?
While playing around with the Java font class and Swing, I set the font size to a negative value.
I discovered that this makes the text be drawn upside down. Is this a bug or a feature? Can anyone ...
6
votes
1
answer
726
views
Static languages and Reflection
As far as i know and understand,
Reflection is the ability to create/modify source code at run time.
From Wikipedia:
Discover and modify source code constructions (such as code blocks,
classes, ...
2
votes
3
answers
267
views
Languages that support boolean syntactic sugar
There's a certain over-verbosity that I have to engage in when writing certain Boolean expressions, at least with all the languages I've used, and I was wondering if there were any languages that let ...
0
votes
3
answers
1k
views
Why can I declare a 2D array with both dimensions sized variable but not new one?
As the problem stated, this is doable:
#include <iostream>
int main(int argc, char *argv[])
{
unsigned short int i;
std::cin >> i;
unsigned long long int k[i][i];
}
Here I ...
3
votes
3
answers
846
views
How do you exit the caller function in JavaScript?
It is possible to return from/exit the caller function i JavaScript?
We are adding testing methods to our framework and we want to exit if we have an error on an Assertion.
Given the following ...
5
votes
2
answers
368
views
How to get the unique slices of a matrix?
In matlab, if you have a matrix A you can find the matrix B containing all of the unique rows of A as follows:
B = unique(A,'rows');
What I have is a 3d matrix, with rows and columns as the first two ...
1
vote
2
answers
164
views
Is this a bug in Python inheritance? [duplicate]
I'm not sure if the output of this code is correct or a bug:
class F:
"""An abstract class"""
list_of_secrets = []
def __init__(self):
pass
def getSecret(self):
return self....
4
votes
3
answers
74
views
Ruby language feature of Set[1,2,3]
In Ruby, a set can be initialized by Set[1,2,3]
So can an array: Array[1,2,3]
Is it possible to write some code to do the same thing to my own classes?
Or it's just a language feature for only a few ...
4
votes
3
answers
379
views
How is Nullable<T> different from a similar custom C# struct?
In Nullable micro-optimizations, part one, Eric mentions that Nullable<T> has a strange boxing behaviour that could not be achieved by a similar user-defined type.
What are the special features ...
2
votes
5
answers
164
views
Does C# Have An Operation Similar to JavaScript's || Setter?
Does C# have a similar operation to JavaScript's || setter?
For example, in JavaScript, if I want to check if a value is null and set a default, I can do something like this:
function foo(val){
...