June 23, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bruno Medeiros | Bruno Medeiros wrote: > Derek Parnell wrote: > >> On Thu, 22 Jun 2006 17:31:16 -0700, BCS wrote: >> >>> How do you get DMD to let you use depreciated "things"? I know it's in there somewhere but I can't seem to find the switch. >> >> Use the "-d" switch. Documented under "Tools / DMD D Compiler" > > And under the dmd command line help. BCS, that was hard to miss. *g* > I'm blind, BLIND I TELL YOU!! :-p "The easy way to find the answer to a question is ask someone who knows. Usually you will figure it out yourself about half a second before they stop smirking and tell you." --B... er Anon. |
June 23, 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
WOW! (For everything) :)
|
June 29, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> Jarrett Billingsley wrote:
>> "Walter Bright" <newshound@digitalmars.com> wrote in message news:e7832r$g4h$1@digitaldaemon.com...
>>> Mostly bug fixes.
>>>
>>> http://www.digitalmars.com/d/changelog.html
>>
>> Oh man, those delegate literals look like it would be very possible to make interesting "pseudo-structures," that is, fake language constructs. So if you were to define a function as
>>
>> void func(void delegate() dg);
>>
>> That is, the last parameter is a void delegate(), it would be an interesting bit of syntactic sugar to be able to write
>>
>> func
>> {
>> writefln("foo");
>> }
>>
>> Not sure what utility this would present, but hey!
>
> There was some thought about doing that, but I'm not so sure it wouldn't be more confusing than useful.
With the new delegate syntax, and a very simple function one can finally replace the annoying and common case where a for-loop until now still has to be used:
void repeat(Int,Delegate)(Int n, Delegate d) {
static assert(is(Int:int),"Argument 1 to repeat must be int");
for (int i = 0; i < n; i++)
d();
}
The implementation could also contain:
static if (NumberOfArgs!(Delegate) == 1)
d(i);
The use is:
repeat(10, { something(); });
And the multi-line version becomes:
repeat(10, {
something();
somethingElse();
});
Which at least makes me wish for Jarretts suggested short form:
repeat(10) {
something();
somethingElse();
}
But the implications of having such power is almost scary... :)
/Oskar
|
June 29, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley wrote: > "Walter Bright" <newshound@digitalmars.com> wrote in message news:e7832r$g4h$1@digitaldaemon.com... > >>Mostly bug fixes. >> >>http://www.digitalmars.com/d/changelog.html > > > Oh man, those delegate literals look like it would be very possible to make interesting "pseudo-structures," that is, fake language constructs. So if you were to define a function as > > void func(void delegate() dg); > > That is, the last parameter is a void delegate(), it would be an interesting bit of syntactic sugar to be able to write > > func > { > writefln("foo"); > } > > Not sure what utility this would present, but hey! > > Deja Vu? http://www.digitalmars.com/d/archives/digitalmars/D/24770.html hehe. |
June 29, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Medlock | "David Medlock" <noone@nowhere.com> wrote in message news:e818mk$fcj$2@digitaldaemon.com... > Deja Vu? > > http://www.digitalmars.com/d/archives/digitalmars/D/24770.html > > hehe. Heh, I thought I remembered that! |
June 30, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Oskar Linde | Oskar Linde wrote:
> Which at least makes me wish for Jarretts suggested short form:
>
> repeat(10) {
> something();
> somethingElse();
> }
But that's exactly what foreach does, isn't it? Would be cool if that construct would be made available to user functions!
L.
|
July 01, 2006 Re: DMD 0.161 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Oskar Linde | Oskar Linde wrote: > Walter Bright wrote: >> Jarrett Billingsley wrote: >>> "Walter Bright" <newshound@digitalmars.com> wrote in message news:e7832r$g4h$1@digitaldaemon.com... >>>> Mostly bug fixes. >>>> >>>> http://www.digitalmars.com/d/changelog.html >>> >>> Oh man, those delegate literals look like it would be very possible to make interesting "pseudo-structures," that is, fake language constructs. So if you were to define a function as >>> >>> void func(void delegate() dg); >>> >>> That is, the last parameter is a void delegate(), it would be an interesting bit of syntactic sugar to be able to write >>> >>> func >>> { >>> writefln("foo"); >>> } >>> >>> Not sure what utility this would present, but hey! >> >> There was some thought about doing that, but I'm not so sure it wouldn't be more confusing than useful. > > With the new delegate syntax, and a very simple function one can finally replace the annoying and common case where a for-loop until now still has to be used: > > void repeat(Int,Delegate)(Int n, Delegate d) { > static assert(is(Int:int),"Argument 1 to repeat must be int"); > for (int i = 0; i < n; i++) > d(); > } > > The implementation could also contain: > static if (NumberOfArgs!(Delegate) == 1) > d(i); > > The use is: > > repeat(10, { something(); }); > > And the multi-line version becomes: > > repeat(10, { > something(); > somethingElse(); > }); > > Which at least makes me wish for Jarretts suggested short form: > > repeat(10) { > something(); > somethingElse(); > } > > But the implications of having such power is almost scary... :) > > /Oskar That's too much power for us puny mortals! :P -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D |
Copyright © 1999-2021 by the D Language Foundation