digitalmars.D.announce - DMD 0.124
- Walter (3/3) May 19 2005 I'm not too sure about iftype. Let's see how it goes. Consider it
- Geert (2/9) May 19 2005
- James Dunne (5/14) May 19 2005 Link to std.boxer page produces digitalmars' homepage in both the Change...
- Walter (4/6) May 19 2005 ChangeLog and
- bobef (7/10) May 19 2005 I don't like the syntax and it's name. I, personaly, like something like
- Geert (14/39) May 19 2005 It's name?? William Shakespeare wrote:
- Kris (6/9) May 19 2005 Calling through interfaces is broken in 0.124 and 0.123; perhaps not all
- Walter (2/6) May 19 2005 Thanks. I'll try and figure out what went wrong.
- Dejan Lekic (17/17) May 19 2005 Walter, thanks for everything... We all really DO apriciate Your enormou...
- Charlie (4/7) May 19 2005 Site looks great!
- Walter (4/5) May 19 2005 Thanks. I still want to replace the frames, though, with a more conventi...
- Andrew Fedoniouk (8/12) May 19 2005 Finally! :)
- Walter (3/8) May 19 2005 It's just the degenerate case.
-
Jarrett Billingsley
(7/7)
May 19 2005
"Walter"
wrote in message - Walter (4/11) May 19 2005 Yes, it'll be removed. This is just a temporary thing to flush out any
- Andrew Fedoniouk (26/30) May 19 2005 Seems like 'static if' and 'iftype' are the same statement.
- Unknown W. Brackets (16/64) May 19 2005 I'd also prefer a merge of "static if" and "iftype". I quite like
- Unknown W. Brackets (3/11) May 19 2005 Err, I guess I didn't meant static if (rather if), as iftype isn't
- Andrew Fedoniouk (20/33) May 20 2005 non-static iftype (non-compile time) has no practical meaning.
- Lionello Lunesu (5/5) May 19 2005 Can't types already be checked with normal if's (using TypeInfo, .typeof...
- Andrew Fedoniouk (13/23) May 20 2005 Agreed, but it is not the case.
- Walter (2/2) May 20 2005 Also, iftype enables picking apart of a type using the type deduction
- Andrew Fedoniouk (9/11) May 20 2005 Yep.
- David Medlock (4/11) May 20 2005 D is Looking great, Walter! Very nice new features.
- Stewart Gordon (12/16) May 20 2005 At the moment I don't see how this
- Ben Hinkle (3/15) May 20 2005 agreed. the "else" clause is dead code if I understand correctly.
- Andrew Fedoniouk (34/34) May 20 2005 static if and especially iftype are in fact kind of anonymous template
- Andrew Fedoniouk (10/10) May 20 2005 Pluses of the approach ( 'mixin template' versus 'iftype' )
- Andrew Fedoniouk (38/42) May 20 2005 'Anonymous template declaration and instantiation'
- Ben Hinkle (5/8) May 20 2005 Are there some motivating examples for "static if" and iftype? The doc
- Walter (4/7) May 20 2005 sure
- Andrew Fedoniouk (32/42) May 20 2005 imagine that somewhere I have a constant WINVER and
- John Reimer (3/14) May 20 2005 Hey... that's not hard to imagine! It looks very familiar. ;-)
- Ben Hinkle (37/81) May 21 2005 makes sense.
I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 19 2005
iftype?!?!! WOW!!! I like it!!! Walter wrote:I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 19 2005
Link to std.boxer page produces digitalmars' homepage in both the ChangeLog and the Phobos page ;) In article <d6iob7$2daa$1 digitaldaemon.com>, Geert says...iftype?!?!! WOW!!! I like it!!! Walter wrote:Regards, James DunneI'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 19 2005
"James Dunne" <james.jdunne gmail.com> wrote in message news:d6ioom$2dok$1 digitaldaemon.com...Link to std.boxer page produces digitalmars' homepage in both theChangeLog andthe Phobos page ;)Fixed.
May 19 2005
I don't like the syntax and it's name. I, personaly, like something like if ( var.typeof == int) or even if ( var.typeof : int) but not iftype ( var : int) In article <d6imvd$2c53$1 digitaldaemon.com>, Walter says...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 19 2005
It's name?? William Shakespeare wrote: 'Tis but thy name that is my enemy; Thou art thyself, though not a Montague. What's Montague? it is nor hand, nor foot, Nor arm, nor face, nor any other part Belonging to a man. O, be some other name! *What's in a name?* that which we call a rose By any other name would smell as sweet; So Romeo would, were he not Romeo call'd, Retain that dear perfection which he owes Without that title. Romeo, doff thy name, And for that name which is no part of thee Take all myself. bobef wrote:I don't like the syntax and it's name. I, personaly, like something like if ( var.typeof == int) or even if ( var.typeof : int) but not iftype ( var : int) In article <d6imvd$2c53$1 digitaldaemon.com>, Walter says...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 19 2005
Calling through interfaces is broken in 0.124 and 0.123; perhaps not all uses, but enough to trash the core of the Mango libraries. Dmd 0.121 is good, as are prior versions all the way back to 0.8x something. There's a post in the buglist. "Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 19 2005
"Kris" <fu bar.com> wrote in message news:d6iq1n$2esk$1 digitaldaemon.com...Calling through interfaces is broken in 0.124 and 0.123; perhaps not all uses, but enough to trash the core of the Mango libraries. Dmd 0.121 is good, as are prior versions all the way back to 0.8x something. There's a post in the buglist.Thanks. I'll try and figure out what went wrong.
May 19 2005
Walter, thanks for everything... We all really DO apriciate Your enormous work... I do not know D internals, and cannot help with D due to lack of time/knowledge, but I did maybe one good thing for D - attached is a BASH script I am using to easily install D on my Linux box. User simply runs ./install.sh 124 and script will connect to digitalmars.com, download package, unpack and install files in proper places. I'll put it on my web-server these days so users can do something like /bin/sh `lynx -source http://.../install.sh` 125 , and use remote script to quickly install new (old versions too) version ... I hope somebody will find this usefull. -- ........... Dejan Lekic http://dejan.lekic.org
May 19 2005
Site looks great! Charlie "Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 19 2005
"Charlie" <charles jwavro.com> wrote in message news:d6irpl$2gd7$1 digitaldaemon.com...Site looks great!Thanks. I still want to replace the frames, though, with a more conventional t.o.c. on the left.
May 19 2005
Finally! :) "The condition is always satisfied, and Identifier is declared to be an alias of Type. " What is the intention, your honour? Andrew. "Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 19 2005
"Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d6jfrq$2uk1$1 digitaldaemon.com...Finally! :) "The condition is always satisfied, and Identifier is declared to be an alias of Type. " What is the intention, your honour?It's just the degenerate case.
May 19 2005
"Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com... Ooh, some nice new things to try out :) Something I've wondered though - will the .size ever bee just ignored? It seems kind of redundant to have an error just for .size when it could just say "no member .size for blah." I suppose the error is just there for porting older D code, but will this error be removed for 1.0?
May 19 2005
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:d6jhcv$2vlb$1 digitaldaemon.com..."Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com... Ooh, some nice new things to try out :) Something I've wondered though - will the .size ever bee just ignored? It seems kind of redundant to have an error just for .size when it could just say "no member .size for blah." I suppose the error is just there for porting older D code, but will this error be removed for 1.0?Yes, it'll be removed. This is just a temporary thing to flush out any remaining older uses.
May 19 2005
Seems like 'static if' and 'iftype' are the same statement. Difference is just in type of condition expression. Is it possible to combine them together somehow and to have just one static if? (I personally prefer 'when' instead of 'static if' but anyway... Currently in D, notation of 'if' statement is as: IfStatement: if ( Expression ) Statement [else Statement] So if we will add: static if ( Expression ) Statement [else Statement] static if typeof ( TypeParameter ) Statement [else Statement] then it will not break existing grammar. Other forms of latter two productions using 'when': when ( Expression ) Statement [else Statement] when typeof ( TypeParameter ) Statement [else Statement] I think that D should have clear "notational distance" between runtime and compile time constructions. static assert and static if are good at this point of view. but standalone 'iftype' is too close to plain 'if'. Just some thoughts aloud... One more: probably this would be better: static if cast ( TypeParameter ) Statement [else Statement] ? Andrew. "Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 19 2005
I'd also prefer a merge of "static if" and "iftype". I quite like static if, myself. I guess I'd push: static if (bar isimplicit int) static if (bar as T) static if (bar as T isimplicit int) Or something. Just seems : is a bit overused for various meanings. Also, it'd be great to have a way to (statically) check for the existance of a symbol (specifically a function or class): static if (&funcname) Or something. The above actually seems to work, but only if it does exist. Otherwise: staticif.d(9): undefined identifier test2 Which is, quite specifically, what I'd like to avoid. This would allow me to release bar, which depends on foo, but have bar able to use foo 1.0 or foo 2.0, depending on what it is compiled with. -[Unknown]Seems like 'static if' and 'iftype' are the same statement. Difference is just in type of condition expression. Is it possible to combine them together somehow and to have just one static if? (I personally prefer 'when' instead of 'static if' but anyway... Currently in D, notation of 'if' statement is as: IfStatement: if ( Expression ) Statement [else Statement] So if we will add: static if ( Expression ) Statement [else Statement] static if typeof ( TypeParameter ) Statement [else Statement] then it will not break existing grammar. Other forms of latter two productions using 'when': when ( Expression ) Statement [else Statement] when typeof ( TypeParameter ) Statement [else Statement] I think that D should have clear "notational distance" between runtime and compile time constructions. static assert and static if are good at this point of view. but standalone 'iftype' is too close to plain 'if'. Just some thoughts aloud... One more: probably this would be better: static if cast ( TypeParameter ) Statement [else Statement] ? Andrew. "Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 19 2005
Err, I guess I didn't meant static if (rather if), as iftype isn't necessarily static, I suppose. -[Unknown]I'd also prefer a merge of "static if" and "iftype". I quite like static if, myself. I guess I'd push: static if (bar isimplicit int) static if (bar as T) static if (bar as T isimplicit int) Or something. Just seems : is a bit overused for various meanings.
May 19 2005
Err, I guess I didn't meant static if (rather if), as iftype isn't necessarily static, I suppose.non-static iftype (non-compile time) has no practical meaning. At runtime type must be known so no uncertainty (if) here. So it is compile time creature. To have two versions of 'static if ' we should have designator boolean/typename expression. E.g. cast expression accepts only typename so it could be parsed reliably. What about this then: static if cast(bar : int) // satisfied because short can be // implicitly converted to int printf("satisfied\n"); else printf("not satisfied\n"); ? BTW: C++ uses < > brackets for typename expressions (many grammatic problems), but static if in C++ could be written as static if <bar:int> ... else ... .... "Unknown W. Brackets" <unknown simplemachines.org> wrote in message news:d6julq$8i7$1 digitaldaemon.com...Err, I guess I didn't meant static if (rather if), as iftype isn't necessarily static, I suppose. -[Unknown]I'd also prefer a merge of "static if" and "iftype". I quite like static if, myself. I guess I'd push: static if (bar isimplicit int) static if (bar as T) static if (bar as T isimplicit int) Or something. Just seems : is a bit overused for various meanings.
May 20 2005
Can't types already be checked with normal if's (using TypeInfo, .typeof)? So why the iftype? or "static if typeof" or for that matter? Existing syntax should be used, if it can be used. Is it beacuse the result of .typeof is not known at compile time? L.
May 19 2005
Can't types already be checked with normal if's (using TypeInfo, .typeof)?In runtime (TypeInfo), yes. In compile time (typeof), no. TypeInfo is an object in runtime, typeof is a type name compile time.So why the iftype? or "static if typeof" or for that matter? Existing syntax should be used, if it can be used.Agreed, but it is not the case.Is it beacuse the result of .typeof is not known at compile time?result of typeof(expression) is known at compile time (it is a compile time function) but you cannot do almost anything useful with it. typeof() evaluates to type name which is (type name) not a string and not an object like TypeInfo. int a; typeof(1) a; are eqiuvalent in D. Andrew. "Lionello Lunesu" <lio lunesu.removethis.com> wrote in message news:d6jvgd$9gn$1 digitaldaemon.com...Can't types already be checked with normal if's (using TypeInfo, .typeof)? So why the iftype? or "static if typeof" or for that matter? Existing syntax should be used, if it can be used. Is it beacuse the result of .typeof is not known at compile time? L.
May 20 2005
Also, iftype enables picking apart of a type using the type deduction capability analogous to the template partial specialization rules.
May 20 2005
"Walter" <newshound digitalmars.com> wrote in message news:d6k3hi$e1u$1 digitaldaemon.com...Also, iftype enables picking apart of a type using the type deduction capability analogous to the template partial specialization rules.Yep. And idea is good. But I think you aren't satisfied with the name too ... static if( ) is good. If we would have some distinctive notation for typenames and deductions then it will be possible to use something like : static if type(T:T[]) { ... } Ideas, anyone?
May 20 2005
Walter wrote:I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.htmlD is Looking great, Walter! Very nice new features. Thanks! -DavidM
May 20 2005
Walter wrote:I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.htmlAt the moment I don't see how this iftype (bar T) alias T S; else alias long S; is any more useful than this alias bar S; Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
May 20 2005
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message news:d6kpfi$vtp$1 digitaldaemon.com...Walter wrote:agreed. the "else" clause is dead code if I understand correctly.I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.htmlAt the moment I don't see how this iftype (bar T) alias T S; else alias long S; is any more useful than this alias bar S;
May 20 2005
static if and especially iftype are in fact kind of anonymous template declaration and instantiation at one point. Lets take a look on given example: alias short bar; int foo(bar x) { iftype (bar : int) // satisfied because short can be // implicitly converted to int printf("satisfied\n"); else printf("not satisfied\n"); } It is in fact: int foo(bar x) { mixin Noname!(bar); template Noname(T) { printf("not satisfied\n"); } template Noname(T: int) { printf("satisfied\n"); } } Therefore if our intention is to move declaration and instantiation in one point we might use 'anonymous templates' : int foo(bar x) { mixin template(bar: int) { printf("not satisfied\n"); } mixin else { printf("satisfied\n"); } } Huh?
May 20 2005
Pluses of the approach ( 'mixin template' versus 'iftype' ) that I can write AND type expressions too mixin(bar: int, foo: double) // if bar is int and foo is double { printf("satisfied\n"); } mixin else { printf("not satisfied\n"); }
May 20 2005
'Anonymous template declaration and instantiation' to change 'static if' on mixin if( BooleanExpression ) ... [ else .... ] to change 'iftype' on mixin when ( Type : TypeSpecialization ) [ else ... ] formal definition of Mixins in the specification is below. This will give us: mixin when(foo: int) printf("foo is like int") ; else when (foo: double) printf("foo is like double") ; else static assert( 0, " foo is neither int nor double" ); mixin if( n == 32 ) int x; else if( n == 16 ) short x; else box x; --------------------------------------------------------- formal definition of Mixins in the specification: TemplateMixin: mixin TemplateIdentifier ; mixin TemplateIdentifier MixinIdentifier ; mixin TemplateIdentifier !( TemplateArgumentList ) ; mixin TemplateIdentifier !( TemplateArgumentList ) MixinIdentifier ; (static if) mixin if( CompileTimeBooleanExpression ) StatementOrBlockDecl mixin if( CompileTimeBooleanExpression ) StatementOrBlockDecl [ else if( CompileTimeBooleanExpression ) StatementOrBlockDecl ] else StatementOrBlockDecl (iftype) mixin when( Type : TypeSpecialization ) StatementOrBlockDecl mixin when( Type : TypeSpecialization ) StatementOrBlockDecl [ else when ( Type : TypeSpecialization ) StatementOrBlockDecl ] else StatementOrBlockDecl "Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.html
May 20 2005
"Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.htmlAre there some motivating examples for "static if" and iftype? The doc example illustrate the behavior but don't do anything useful so I'm not sure when to use these constructs vs template specialization.
May 20 2005
"Ben Hinkle" <bhinkle mathworks.com> wrote in message news:d6lf5g$1iv7$1 digitaldaemon.com...Are there some motivating examples for "static if" and iftype? The doc example illustrate the behavior but don't do anything useful so I'm notsurewhen to use these constructs vs template specialization.www.digitalmars.com/d/cpptod.html, look at the last example
May 20 2005
imagine that somewhere I have a constant WINVER and enum winver{ WIN95, WIN98, WINME, WIN2K, WINXP, WIN2K3, WINXP64 } so I can do something like this (statically) static if( WINVER <= WINME) // mixin if .... 16bit GDI ops... else if ( WINVER >= WINXP64) .... 64bit GDI ops... else .... 32bit GDI ops... In fact if there are just few choices in enum winver I will probably do this by using mixins or probably version. mixin when (iftype) is a bit more interesting as it allows you to do instantiation more deterministic and flexible: mixin when( coordinate : long, color : long ) .... else when( coordinate : int, color : long ) .... else when( coordinate : long ) .... else when( coordinate : int ) .... else static assert(0, "unsuppported target configuration"); ----------------------------------------------- But of course we can live without this ... It is just a matter of comfort I would say. Andrew. "Ben Hinkle" <bhinkle mathworks.com> wrote in message news:d6lf5g$1iv7$1 digitaldaemon.com..."Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.htmlAre there some motivating examples for "static if" and iftype? The doc example illustrate the behavior but don't do anything useful so I'm not sure when to use these constructs vs template specialization.
May 20 2005
Andrew Fedoniouk wrote:imagine that somewhere I have a constant WINVER and enum winver{ WIN95, WIN98, WINME, WIN2K, WINXP, WIN2K3, WINXP64 }Hey... that's not hard to imagine! It looks very familiar. ;-) -JJR
May 20 2005
"Andrew Fedoniouk" <news terrainformatica.com> wrote in message news:d6lj2t$1lqg$1 digitaldaemon.com...imagine that somewhere I have a constant WINVER and enum winver{ WIN95, WIN98, WINME, WIN2K, WINXP, WIN2K3, WINXP64 } so I can do something like this (statically) static if( WINVER <= WINME) // mixin if .... 16bit GDI ops... else if ( WINVER >= WINXP64) .... 64bit GDI ops... else .... 32bit GDI ops... In fact if there are just few choices in enum winver I will probably do this by using mixins or probably version.makes sense.mixin when (iftype) is a bit more interesting as it allows you to do instantiation more deterministic and flexible: mixin when( coordinate : long, color : long ) .... else when( coordinate : int, color : long ) .... else when( coordinate : long ) .... else when( coordinate : int ) .... else static assert(0, "unsuppported target configuration");Iftype is actually pretty fun. I've started using iftype in MinTL to support custom memory allocators. For example a couple of simple used in Deque are struct Deque(Value, Alloc = GCAllocator) { void clear() { iftype (Alloc : GCAllocator) { } else { foreach (Block p; data) { Alloc.freeData(p); } Alloc.free(data.ptr); } *this = Deque.init; } Block newBlock() { iftype (Alloc : GCAllocator) { return new Value[BlockSize]; } else { Value* p = cast(Value*)Alloc.mallocData(BlockSize * Value.sizeof); Value[] q = p[0..BlockSize]; q[] = Value.init; return p; } ... } So this way a user can declare Deque!(int) x; to get a standard entirely-GC allocator or use a predefined allocator like Deque!(int,Malloc) y; that is aliased to use std.c.stdlib.malloc and friends. Another one of the predefined allocators is GCMalloc that allocates data from the GC since it may contain root and non-data from malloc. Of course using malloc one has to be careful to not leak but that's expected. Anyhow, maybe I'll also cook up an allocator to work around the +1 issue that makes GC allocations so inefficient. I haven't tried that yet.----------------------------------------------- But of course we can live without this ... It is just a matter of comfort I would say. Andrew. "Ben Hinkle" <bhinkle mathworks.com> wrote in message news:d6lf5g$1iv7$1 digitaldaemon.com..."Walter" <newshound digitalmars.com> wrote in message news:d6imvd$2c53$1 digitaldaemon.com...I'm not too sure about iftype. Let's see how it goes. Consider it 'experimental' for now. http://www.digitalmars.com/d/changelog.htmlAre there some motivating examples for "static if" and iftype? The doc example illustrate the behavior but don't do anything useful so I'm not sure when to use these constructs vs template specialization.
May 21 2005