Skip to main content

Questions tagged [language-construct]

The tag has no usage guidance, but it has a tag wiki.

language-construct
4 votes
0 answers
213 views

Variable Overloading

This question originated in a discussion with a colleague and it is purely academic. Is there any programming language that has variable overloading? In Java and many other languages, there is ...
Dakkaron's user avatar
  • 6,218
4 votes
1 answer
266 views

Where is PHP echo implemented in the source?

You can lookup built-in functions by searching for e.g. PHPAPI(stream_copy_to_stream) and find the implementation in ext/standard/streamsfuncs.c. How to do that for a language construct like echo? I ...
cachius's user avatar
  • 1,877
0 votes
1 answer
41 views

Can I use an implicit class name in Dart?

Is there any way to avoid having to explicitly specify a class name in Dart, when using it multiple times? Let's say I have something like class VehicleType{ static const int BICYCLE = 0; ...
Magnus's user avatar
  • 18.2k
2 votes
2 answers
67 views

Does PHP have a facility to reduce the duplication of parameter declaration and initialization in the class and the constructor?

Consider writing the class below: class SomeClass { /** @var array */ private $files; /** @var string */ private $productName; /** @var bool */ private $singlePage; /** ...
Dennis's user avatar
  • 8,069
0 votes
1 answer
41 views

How can few entities be used in different manner? What are those entities actually called?

I'm learning PHP. While learning PHP, I noticed that there are few entities in PHP which are used in different fashion. Sometimes with the pair of parenthesis with the enclosing parameter/s between ...
PHPLover's user avatar
  • 12.9k
2 votes
2 answers
858 views

What does "array_expression" mean in php?

http://php.net/manual/en/control-structures.foreach.php Trying to better understand the foreach loop. In the documentation above it states "The first form loops over the array given by ...
Kohler Fryer's user avatar
2 votes
1 answer
1k views

C# equivalent of C++ std::vector<int>.end()

I was trying to rewrite some C++ code I found on the internet in C# for my hexagon sphere project, but I ran into the following code: if((((*ti)->m_hexA) != tileNdx) && (find(nbrs. begin(),...
Jax's user avatar
  • 402
1 vote
0 answers
140 views

What is the purpose of this case label?

Inside boost/asio/coroutine.hpp there is case statement inside the definition of the macro yield which seems to be inaccessible: switch (_coro_value ? 0 : 1) \ for (;;) \ case -1: if (...
Oliv's user avatar
  • 17.9k
27 votes
6 answers
15k views

Specifying default parameter when calling C++ function

Suppose I have code like this: void f(int a = 0, int b = 0, int c = 0) { //...Some Code... } As you can evidently see above with my code, the parameters a,b, and c have default parameter values ...
Arnav Borborah's user avatar
1 vote
1 answer
766 views

Is the Scala `match` construct syntactic sugar? If so, how does is work?

In trait Expr case class Number(n: Int) extends Expr case class Sum(e1: Expr, e2: Expr) extends Expr object CaseExample { def eval(e: Expr): Int = e match { case Number(n) => n case Sum(...
Make42's user avatar
  • 12.8k
1 vote
2 answers
55 views

PHP Declarator In If-Statement Scope

This is pretty basic. Let's say you define a variable in an if statement if($stmt = $db->prepare($sql)) { // do stuff } Can I access $stmt below the if statement? Or does $stmt need to be ...
Kellen Stuart's user avatar
1 vote
1 answer
104 views

Can I use variable functions with language constructs?

This question here kinda address the issue. In my case I would like to call a function like empty() or is_int(). For example: <?php $foo = 'empty'; $test = NULL; $foo($test); This ...
Francisco Luz's user avatar
78 votes
4 answers
28k views

How can I emulate destructuring in C++?

In JavaScript ES6, there is a language feature known as destructuring. It exists across many other languages as well. In JavaScript ES6, it looks like this: var animal = { species: 'dog', ...
Trevor Hickey's user avatar
0 votes
0 answers
91 views

ruby construct for preserving original value of a variable after block execution

Sometimes I need to preserve the original value of a variable, do stuff and then restore its original value kind of like this: def method original_value = @variable @variable = true result = # ...
e.nikolov's user avatar
  • 137
0 votes
4 answers
756 views

Does JavaScript have a language construct similar to the php list command?

Does JavaScript have a language construct or something similar to the php list command? http://php.net/manual/en/function.list.php This command will assign the values of an array to variables in a ...
ciso's user avatar
  • 3,020

15 30 50 per page