On Friday, 29 September 2017 at 01:51:36 UTC, Jerry wrote:
[...]
Maybe this?
ref auto at(T : U[], U)(T arr, size_t index) {
return arr[index];
}
int main(string[] argv)
{
int* a = new int(1);
int[] b = [1];
int[1] c = [1];
a.at(0); // won't compile
b.at(0);
c.at(0)
On Friday, 29 September 2017 at 09:56:17 UTC, Dukc wrote:
On Friday, 29 September 2017 at 09:12:54 UTC, Don Clugston
wrote:
Guess what this prints
My guess is it prints "1".
By "guess" I mean it, I did not test! Anyway reminds me a lot
of very badly used gotos.
Yeah, it's a lot like Duff's
On 28 September 2017 at 11:58, Walter Bright via Digitalmars-d <
digitalmars-d@puremagic.com> wrote:
> On 9/27/2017 4:21 PM, Manu wrote:
>
>> D does not have ADL,
>>
>
> Thank gawd! :-)
>
> which will almost certainly lead to _very_ nasty surprises in behaviour.
>>
>
> ADL was always a hack to get
On Friday, 29 September 2017 at 03:37:53 UTC, Jonathan M Davis
wrote:
On Friday, September 29, 2017 01:51:36 Jerry via Digitalmars-d
wrote:
I miss ref variables, for the simple fact that using the
square brackets with a ref variable doesn't access the
pointer. Don't know how many times I've acc
On 29.09.2017 17:05, Don Clugston wrote:
I don't see what your proposed grammar change accomplishes:
switch(i){
for(i=8;i<10;++i){
case 7:
writeln(i);
return;
default:{}
}
}
I.e., you seem to have misidentified the culprit. Whether or not to
the
On Friday, 29 September 2017 at 16:40:38 UTC, Gheorghe Gabriel
wrote:
On Friday, 29 September 2017 at 16:24:32 UTC, bitwise wrote:
On Friday, 29 September 2017 at 11:05:00 UTC, Gheorghe Gabriel
wrote:
[...]
If i compile this script to a .dll
DLL support for D is currently very spotty. Before
On Friday, 29 September 2017 at 16:24:32 UTC, bitwise wrote:
On Friday, 29 September 2017 at 11:05:00 UTC, Gheorghe Gabriel
wrote:
[...]
If i compile this script to a .dll
DLL support for D is currently very spotty. Before investing
too much time, I would suggest confirming that DLLs are even
On Fri, Sep 29, 2017 at 12:32:02PM +0200, Timon Gehr via Digitalmars-d wrote:
[...]
> It is very likely that this part of the grammar was deliberately
> copied from C. It's also consistent with how all other control flow
> constructs are parsed.
I believe one of the reasons the grammar was written
On Friday, 29 September 2017 at 11:05:00 UTC, Gheorghe Gabriel
wrote:
[...]
If i compile this script to a .dll
DLL support for D is currently very spotty. Before investing too
much time, I would suggest confirming that DLLs are even properly
supported for your target platform at all.
On Friday, 29 September 2017 at 10:32:02 UTC, Timon Gehr wrote:
On 29.09.2017 11:12, Don Clugston wrote:
Guess what this prints
import std.stdio;
void main()
{
int i = 0;
switch (i) for (i = 8; i < 10; ++i)
{
case 7:
writeln(i);
return;
default: ;
On Friday, 29 September 2017 at 11:20:13 UTC, Cecil Ward wrote:
I love the D >>> operator and I use it a lot. So much safer
than the chaos in C.
I would absolutely love to have unsigned comparison operators
in D. Do you agree? What on earth would the syntax be like?
Yes, I could write a gene
On Friday, 29 September 2017 at 13:07:32 UTC, Atila Neves wrote:
auto modifiable = foo();
{
const nonModifiable = modifiable;
//...
}
I had already thought about using two names.
I don’t think that using a kind of ‘const-alias’ mechanism (or
‘const reference’, in the C++ var& sense) w
On Friday, 29 September 2017 at 11:12:32 UTC, Cecil Ward wrote:
An idea, I’d be interested to hear if this might be at all
useful to anyone -
If and only if a variable is declared as modifiable (neither
immutable nor const), would it possibly be useful to be able to
have a kind of scope const
I love the D >>> operator and I use it a lot. So much safer than
the chaos in C.
I would absolutely love to have unsigned comparison operators in
D. Do you agree? What on earth would the syntax be like?
Yes, I could write a generic function or something, but the
result would look ugly. And I
An idea, I’d be interested to hear if this might be at all useful
to anyone -
If and only if a variable is declared as modifiable (neither
immutable nor const), would it possibly be useful to be able to
have a kind of scope const on/off switch to either impose const
within a block, and/or the
On Friday, 29 September 2017 at 09:34:26 UTC, JN wrote:
On Wednesday, 27 September 2017 at 20:03:27 UTC, Gheorghe
Gabriel wrote:
Hi,
I have a 3D scene editor.
I need my scripts to be dynamically loaded in the scene.
In c# or java I can use reflections to do that.
How can I do that with D?
I kno
On 29.09.2017 11:12, Don Clugston wrote:
Guess what this prints
import std.stdio;
void main()
{
int i = 0;
switch (i) for (i = 8; i < 10; ++i)
{
case 7:
writeln(i);
return;
default: ;
}
}
Why does this even compile? It's because the grammar
On Friday, 29 September 2017 at 09:12:54 UTC, Don Clugston wrote:
Guess what this prints
My guess is it prints "1".
By "guess" I mean it, I did not test! Anyway reminds me a lot of
very badly used gotos.
On Wednesday, 27 September 2017 at 20:03:27 UTC, Gheorghe Gabriel
wrote:
Hi,
I have a 3D scene editor.
I need my scripts to be dynamically loaded in the scene.
In c# or java I can use reflections to do that.
How can I do that with D?
I know that std.traits only works in compile time.
Please, hel
Guess what this prints
import std.stdio;
void main()
{
int i = 0;
switch (i) for (i = 8; i < 10; ++i)
{
case 7:
writeln(i);
return;
default: ;
}
}
Why does this even compile? It's because the grammar is:
SwitchStatement:
switch ( Expression ) Sc
On Friday, 29 September 2017 at 01:51:36 UTC, Jerry wrote:
Don't know how many times I've accidentially used a pointer as
an array.
Using @safe let's the compiler to catch that. Well, in it you
can't use pointer arithmetic even explicitly, but if you have
many elements to point at you're usua
21 matches
Mail list logo