June 20, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | BCS wrote:
> Walter Bright wrote:
>> Stewart Gordon wrote:
>>>
>>> "Fixed Bugzilla 85 (now issues error message)"
>>>
>>
>> 85: It can't be made to work, because an interface handle is different from a class handle. It doesn't work in C++, either, for the same reasons.
>
> Anyway to get a cast? (If it is already there...)
> Somthing like:
>
> interface I{...}
> class C : I {...}
> ...
>
> C[] c;
> I[] i;
>
> c = ....;
>
> i = cast(I)c;
>
> // same as
>
> i.length = c.length;
> foreach(int j, C e; c)
> i[j] = (null !is e)?e:null;
>
You'll have to iterate over the loop and cast each element.
|
June 20, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | The new delegate syntax reminds me Smalltalk's code blocks. As far as I remember, Ruby also uses code blocks with a syntax using braces rather than bracket. Smalltalk: collection do:[ :each | Transcript show: each asString ; cr. ]. D: collection.do (( Object each ){ writefln ( each ); }); ( a foreach would be preferrable in that case, but it's just to notice the similarities ). D is getting greater and greater. Thanks Walter !!! |
June 20, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | In article <e7832r$g4h$1@digitaldaemon.com>, Walter Bright says... > >Mostly bug fixes. > >http://www.digitalmars.com/d/changelog.html This post might be more useful in here, because I think it might be a bug in the latest v0.161 release, and I wanted to get Walter's attention :) http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/39132 |
June 20, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeremy | Jeremy wrote:
> This post might be more useful in here, because I think it might be a bug in the
> latest v0.161 release, and I wanted to get Walter's attention :)
>
> http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/39132
I need a small, reproducible example.
|
June 20, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote: > Mostly bug fixes. > > http://www.digitalmars.com/d/changelog.html Nice work, Walter. Thank you. I hoped the following code will not compile with .161 #struct A #{ # int x; #} # #void main() #{ # A a; # with(a) { # int x; // compiles without error # } #} Vladimir |
June 20, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rémy Mouëza | "Rémy Mouëza" <Rémy_member@pathlink.com> wrote in message news:e79hbc$2tul$1@digitaldaemon.com... > Smalltalk: > collection do:[ :each | Transcript show: each asString ; cr. ]. > > D: > collection.do (( Object each ){ writefln ( each ); }); > ( a foreach would be preferrable in that case, but it's just to notice the > similarities ). That is an awesome comparison. |
June 20, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir | Vladimir wrote:
> Walter Bright wrote:
>> Mostly bug fixes.
>>
>> http://www.digitalmars.com/d/changelog.html
>
> Nice work, Walter. Thank you.
>
> I hoped the following code will not compile with .161
>
> #struct A
> #{
> # int x;
> #}
> #
> #void main()
> #{
> # A a;
> # with(a) {
> # int x; // compiles without error
> # }
> #}
A.x is a field, not a local variable, so the shadowing rule doesn't apply.
|
June 21, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | "Walter Bright" <newshound@digitalmars.com> wrote in message news:e79d2a$2o0c$2@digitaldaemon.com... > There was some thought about doing that, but I'm not so sure it wouldn't be more confusing than useful. Hehe, how true. But hey, check it out: void foo(void delegate() dg) { writefln("before"); dg(); } foo = { writefln("inside!"); }; A bit of property abuse.. |
June 21, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | On Tue, 20 Jun 2006 21:12:22 -0400, Jarrett Billingsley wrote: > But hey, check it out: > > void foo(void delegate() dg) > { > writefln("before"); > dg(); > } > > foo = > { > writefln("inside!"); > }; > > A bit of property abuse.. LOL ... Here is an extended test ... import std.stdio; void foo(void delegate() dg) { writefln("before"); dg(); writefln("after\n"); } void main(char[][] arg) { char[] str; void bar() { writefln(arg[0] ~ ":" ~ str); } foo = { writefln("inside!"); }; foo = { writefln("again!"); }; foo( {writefln("last time");} ); str = "not really"; foo(&bar); str = "RUBBISH"; foo = &bar; } -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 21/06/2006 12:40:50 PM |
June 21, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | BCS wrote:
> Chris Miller wrote:
>> On Tue, 20 Jun 2006 02:03:08 -0400, Walter Bright <newshound@digitalmars.com> wrote:
>>
>>> Mostly bug fixes.
>>>
>>> http://www.digitalmars.com/d/changelog.html
>>
>>
>>
>> Wow, that new literal delegate syntax is crazy but I like it.
>>
> [...]
>
> Ohhhh fun!! Try finding the bug in this one (ignore the hints).
-snip-
It seems to work just fine here? Prints 2, exactly what I expected :)
L.
|
Copyright © 1999-2021 by the D Language Foundation