Re: pass variable names

2009-07-09 Thread BCS
Hello Saaa, No. You should be able to get the name using an alias: void func(alias var)() { writefln(var.stringof); } Can this be combined with the tuple parameter? I'll seconds this, there doesn't seem to be any way to generate tuples of aliases and this is another cases where it would b

Re: pass variable names

2009-07-09 Thread Saaa
> No. > > You should be able to get the name using an alias: > > void func(alias var)() > { >writefln(var.stringof); > } Can this be combined with the tuple parameter? > > But you can't do it at runtime. > >> Also how do I fix this: >> -- >> functio(`i`); // Error: "i" is not an lvalue > > You

Re: pass variable names

2009-07-09 Thread Daniel Keep
Saaa wrote: > Is it possible to get the passed variable name � la: > -- > void functio(A...)(ref A a) > { > writefln(typeof(a[0])); > } > int i; > functio(i); // prints "i" No. You should be able to get the name using an alias: void func(alias var)() { writefln(var.stringof); } But yo

pass variable names

2009-07-09 Thread Saaa
Is it possible to get the passed variable name à la: -- void functio(A...)(ref A a) { writefln(typeof(a[0])); } int i; functio(i); // prints "i" -- Also how do I fix this: -- functio(`i`); // Error: "i" is not an lvalue --

mixins

2009-07-09 Thread Ellery Newcomer
>From the specs: It is not an error to have const module variable declarations without initializers if there is no constructor. This is to support the practice of having modules serve only as declarations that are not linked in, the implementation of it will be in another module that is linked in.

Re: Regex

2009-07-09 Thread Robert Fraser
BLS wrote: Vladimir Voinkov wrote: std.regex can't be used in compile time function call. It's quite frustrating... see dsource.org .. afaik there is a compile time regex project. hth http://www.dsource.org/projects/scregexp But the generated functions aren't CTFE-compatible AFAIK. A CTFE r

Re: Array slice length confusion

2009-07-09 Thread grauzone
Daniel Keep wrote: Tim Matthews wrote: Kagamin wrote: Tim Matthews Wrote: I thought a slice would behave slighty different due to some sort of meta data that is a separate area of memory so it doesn't effect D's abi. Current plan is to introduce new type - array - into the language. Do yo

Re: Array slice length confusion

2009-07-09 Thread BCS
Hello Tim, Sorry I misread (lacking sleep). Been there, done that. :oz

Re: Array slice length confusion

2009-07-09 Thread Tim Matthews
Sorry I misread (lacking sleep). I can just re slice from the slice, silly me. import std.stdio; void extendSlice(T)(ref T[] slice, uint extendCount) { slice = slice.ptr[0..slice.length+extendCount]; } void main() { char[] a = "Hello".dup; char[] b; b = a[1..3]; //b is a view i

Re: D2 using std.proccess.shell

2009-07-09 Thread Jesse Phillips
On Thu, 09 Jul 2009 11:20:54 +0200, Lars T. Kyllingstad wrote: > Jesse Phillips wrote: >> On Tue, 07 Jul 2009 12:04:43 +0200, Lars T. Kyllingstad wrote: >> >>> Jesse Phillips wrote: I don't know if I'm misunderstanding the use of shell() or if this is a bug. Trying to run some programs

Re: Array slice length confusion

2009-07-09 Thread BCS
Hello Tim, BCS wrote: Hello Tim, Anyway I like how you can get a slice of array that is just a view into the original. If I modify the slice, it modifies the full original array which can be very useful. If however I modify the length of the slice which I was doing in an attempt to extend th

Re: Regex

2009-07-09 Thread BLS
Vladimir Voinkov wrote: std.regex can't be used in compile time function call. It's quite frustrating... see dsource.org .. afaik there is a compile time regex project. hth

Regex

2009-07-09 Thread Vladimir Voinkov
std.regex can't be used in compile time function call. It's quite frustrating...

Re: Array slice length confusion

2009-07-09 Thread Daniel Keep
Tim Matthews wrote: > Kagamin wrote: >> Tim Matthews Wrote: >> >>> I thought a slice would behave slighty different due to some sort of >>> meta data that is a separate area of memory so it doesn't effect D's >>> abi. >>> >> Current plan is to introduce new type - array - into the language. > >

Re: Array slice length confusion

2009-07-09 Thread Tim Matthews
Kagamin wrote: Tim Matthews Wrote: I thought a slice would behave slighty different due to some sort of meta data that is a separate area of memory so it doesn't effect D's abi. Current plan is to introduce new type - array - into the language. Do you know the ng posts or where ever that w

Re: D2 using std.proccess.shell

2009-07-09 Thread Lars T. Kyllingstad
Jesse Phillips wrote: On Tue, 07 Jul 2009 12:04:43 +0200, Lars T. Kyllingstad wrote: Jesse Phillips wrote: I don't know if I'm misunderstanding the use of shell() or if this is a bug. Trying to run some programs with shell error with a could not close file. Sadly it I can come to any reasonabl

Re: Array slice length confusion

2009-07-09 Thread Kagamin
Tim Matthews Wrote: > I thought a slice would behave slighty different due to some sort of > meta data that is a separate area of memory so it doesn't effect D's abi. > Current plan is to introduce new type - array - into the language.

Re: Array slice length confusion

2009-07-09 Thread Tim Matthews
BCS wrote: Hello Tim, Anyway I like how you can get a slice of array that is just a view into the original. If I modify the slice, it modifies the full original array which can be very useful. If however I modify the length of the slice which I was doing in an attempt to extend the view, it bec