Thread overview | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
August 21, 2006 DMD 0.165 release | ||||
---|---|---|---|---|
| ||||
I was going to call this 1.0 RC1, but I just could not resist adding the lazy expression evaluation. This adds one of the big capabilities of common lisp. http://www.digitalmars.com/d/changelog.html |
August 21, 2006 Re: DMD 0.165 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Sun, 20 Aug 2006 21:32:37 -0700, Walter Bright wrote: > I was going to call this 1.0 RC1, but I just could not resist adding the lazy expression evaluation. This adds one of the big capabilities of common lisp. > > http://www.digitalmars.com/d/changelog.html Wow! Neat ... but ... So now you'll be working on getting the Docs synchronized with the compiler and adding the "missing" bits, right? Then RC1 can emerge? -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 21/08/2006 2:57:27 PM |
August 21, 2006 Re: DMD 0.165 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> I was going to call this 1.0 RC1, but I just could not resist adding the lazy expression evaluation. This adds one of the big capabilities of common lisp.
>
> http://www.digitalmars.com/d/changelog.html
Simply WOW !
I can't wait to use the feature. Btw, I think there is a bug in the Enforce example... IMO It should look more like in this test case:
import std.stdio;
class Spam {
void ham() {
writefln("ham() called !");
}
}
T Enforce(T)(T delegate() p, char[] msg)
{
writefln("entering Enforce()");
auto res = p();
if (!res)
throw new Exception(msg);
return res;
}
Spam foo(int a, int b) {
writefln("entering foo()");
if (a == b) return new Spam;
else return null;
}
void main() {
Enforce(foo(1, 1), "omigosh !").ham();
Enforce(foo(1, 2), "omigosh !").ham();
}
--
Tomasz Stachowiak /+ a.k.a. h3r3tic +/
|
August 21, 2006 Re: DMD 0.165 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tom S | Tom S wrote:
> Walter Bright wrote:
>> I was going to call this 1.0 RC1, but I just could not resist adding the lazy expression evaluation. This adds one of the big capabilities of common lisp.
>>
>> http://www.digitalmars.com/d/changelog.html
>
> Simply WOW !
> I can't wait to use the feature. Btw, I think there is a bug in the Enforce example... IMO It should look more like in this test case:
>
>
>
> import std.stdio;
>
>
> class Spam {
> void ham() {
> writefln("ham() called !");
> }
> }
>
>
> T Enforce(T)(T delegate() p, char[] msg)
> {
> writefln("entering Enforce()");
> auto res = p();
> if (!res)
> throw new Exception(msg);
> return res;
> }
>
>
> Spam foo(int a, int b) {
> writefln("entering foo()");
> if (a == b) return new Spam;
> else return null;
> }
>
>
> void main() {
> Enforce(foo(1, 1), "omigosh !").ham();
> Enforce(foo(1, 2), "omigosh !").ham();
> }
Ooops maybe I'm too sleepy. You probably meant Enforce to look like this:
T Enforce(T)(T p, char[] delegate() msg)
{
if (!p)
throw new Exception(msg());
return p;
}
That would make more sense, as the message is lazily evaluated then...
|
August 21, 2006 Re: DMD 0.165 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote: > I was going to call this 1.0 RC1, but I just could not resist adding the lazy expression evaluation. This adds one of the big capabilities of common lisp. Whoa! Really, I'm speechless! I've been toying around with Haskell a lot recently and I really like this feature in D. Thanks, Walter! -- Niko Korhonen SW Developer |
August 21, 2006 Re: DMD 0.165 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> I was going to call this 1.0 RC1, but I just could not resist adding the lazy expression evaluation. This adds one of the big capabilities of common lisp.
>
> http://www.digitalmars.com/d/changelog.html
That's just great! Cool.
|
August 21, 2006 Re: DMD 0.165 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> I was going to call this 1.0 RC1, but I just could not resist adding the lazy expression evaluation. This adds one of the big capabilities of common lisp.
>
> http://www.digitalmars.com/d/changelog.html
Awesome. Two observations:
* Together with lambda delegate type inference, it seems that delegates are becoming the central language idiom of D. It's not just an improved C++ any more, I think a whole new programming style is developing.
* Andrei's involvement in D seems to be increasing. Can we expect him to publish some D code soon?
|
August 21, 2006 Re: DMD 0.165 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | The supplied example: void foo() { int v = 2; cond ( scase(v == 1, writefln("it is 1")), scase(v == 2, writefln("it is 2")), scase(v == 3, writefln("it is 3")), scase(true, writefln("it is the default")) ); } Gives errors: 'voids have no value'. It works when writefln is changed to printf, as it returns an int... It would be cool if voids were also allowed to be lazy. -- Tomasz Stachowiak |
August 21, 2006 Re: DMD 0.165 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | Don Clugston wrote: > * Together with lambda delegate type inference, it seems that delegates are becoming the central language idiom of D. It's not just an improved C++ any more, I think a whole new programming style is developing. Inner classes, nested functions, delegates, and closures are all closely related. The only thing missing in D is the full generality of closures; once we have that I think D can do what Lisp does, but with a much more palatable syntax. > * Andrei's involvement in D seems to be increasing. Can we expect him to publish some D code soon? Andrei is one of the few original thinkers in programming. With D he's been generous with his ideas and critiques, but he's pretty wrapped up with his university studies. |
August 21, 2006 Re: DMD 0.165 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Hmmm... what does the last example about Enforce have to do with lazy evaluation?
It seems like a nice idea, etc., but I can actually run it already without upgrading to 0.165.....?
Does really sound nice, though :).
-[Unknown]
> I was going to call this 1.0 RC1, but I just could not resist adding the lazy expression evaluation. This adds one of the big capabilities of common lisp.
>
> http://www.digitalmars.com/d/changelog.html
|
Copyright © 1999-2021 by the D Language Foundation