Thread overview | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 03, 2004 DMD 0.77 release | ||||
---|---|---|---|---|
| ||||
Lots of new additions. Didn't get to most of the bug reports; I wanted to get D to be 'feature complete' first, the next version will be bug polishing. I'm setting sights on releasing D 1.0 by March. Lots of improvements to templates: o No more instance keyword (though still supported for the time being). To instantiate template Foo with arguments a,b use: Foo!(a,b) which is equivalent to the C++: Foo<a,b> but doesn't have parsing problems. o If there's only one declaration in a template, and its name matches the template name, it is 'promoted' to the enclosing scope: template Foo(T) { class Foo { T a,b; }} ... void func() { Foo(int) x; x.a = 3; } o As a shortcut to the above, the template could have been written as: class Foo(T) { T a,b; } There is no equivalent shortcut for function templates, the syntax would look too awful. But this works: template Max(T) { T Max(T a, T b) { return ... ; } } ... x = Max!(int)(5,7); o Templates can now take 'alias' parameters where any non-local symbol can be substituted: template Foo(alias S) { int* x = &S; } See the changelog for more cool stuff: http://www.digitalmars.com/d/changelog.html |
January 03, 2004 Re: DMD 0.77 release - where is c.math ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | On Fri, 02 Jan 2004 20:00:56 -0800, Walter wrote:
> Lots of new additions.
:)
but where is std.c.math ?
Ant
|
January 03, 2004 Re: DMD 0.77 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote:
> Lots of new additions. Didn't get to most of the bug reports; I wanted to
> get D to be 'feature complete' first, the next version will be bug
> polishing. I'm setting sights on releasing D 1.0 by March.
>
> Lots of improvements to templates:
>
> o No more instance keyword (though still supported for the time being).
> To instantiate template Foo with arguments a,b use:
> Foo!(a,b)
> which is equivalent to the C++:
> Foo<a,b>
> but doesn't have parsing problems.
>
> o If there's only one declaration in a template, and its name matches the
> template name, it is 'promoted' to the enclosing scope:
>
> template Foo(T) { class Foo { T a,b; }}
> ...
> void func()
> {
> Foo(int) x;
> x.a = 3;
> }
>
> o As a shortcut to the above, the template could have been written as:
>
> class Foo(T) { T a,b; }
>
> There is no equivalent shortcut for function templates, the syntax would
> look too awful. But this works:
>
> template Max(T) { T Max(T a, T b) { return ... ; } }
> ...
> x = Max!(int)(5,7);
>
> o Templates can now take 'alias' parameters where any non-local symbol can
> be substituted:
>
> template Foo(alias S) { int* x = &S; }
>
> See the changelog for more cool stuff:
>
> http://www.digitalmars.com/d/changelog.html
>
>
>
Looks very impressive walter, keep up the excellent work!
yay @ switch case expressionlist
|
January 03, 2004 Re: DMD 0.77 release - where is c.math ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | "Ant" <duitoolkit@yahoo.ca> wrote in message news:pan.2004.01.03.04.53.11.207275@yahoo.ca... > but where is std.c.math ? It's there now. |
January 03, 2004 Re: DMD 0.77 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Wow. You've been busy!
Frankly speaking, I think the new templates just plain rock! ;)
Especially the alias mechanism is something that looks minor at first but could turn out to be very useful. It is now possibly to rename namespaces and just about everything else!
Great work!
Btw: the "name promotion" feature is missing in the docs on the website.
Hauke
Walter wrote:
> Lots of new additions. Didn't get to most of the bug reports; I wanted to
> get D to be 'feature complete' first, the next version will be bug
> polishing. I'm setting sights on releasing D 1.0 by March.
>
> Lots of improvements to templates:
>
> o No more instance keyword (though still supported for the time being).
> To instantiate template Foo with arguments a,b use:
> Foo!(a,b)
> which is equivalent to the C++:
> Foo<a,b>
> but doesn't have parsing problems.
>
> o If there's only one declaration in a template, and its name matches the
> template name, it is 'promoted' to the enclosing scope:
>
> template Foo(T) { class Foo { T a,b; }}
> ...
> void func()
> {
> Foo(int) x;
> x.a = 3;
> }
>
> o As a shortcut to the above, the template could have been written as:
>
> class Foo(T) { T a,b; }
>
> There is no equivalent shortcut for function templates, the syntax would
> look too awful. But this works:
>
> template Max(T) { T Max(T a, T b) { return ... ; } }
> ...
> x = Max!(int)(5,7);
>
> o Templates can now take 'alias' parameters where any non-local symbol can
> be substituted:
>
> template Foo(alias S) { int* x = &S; }
>
> See the changelog for more cool stuff:
>
> http://www.digitalmars.com/d/changelog.html
>
>
>
|
January 03, 2004 Re: DMD 0.77 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | About pragma's: couldn't these be implemented using versioning functionality instead? Each compiler defines an identifier as its version already, and proprietary extensions would then have to be enclosed in such version sections. For example: version (DigitalMars) { __some_proprietary_keyword__ int x; } else { int x; } Reasoning behind this: I tend to prefer minimalistic feature sets |
January 03, 2004 Re: DMD 0.77 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote: >o No more instance keyword (though still supported for the time being). >To instantiate template Foo with arguments a,b use: > > Does this imply that your going to remove the instance keyword some time in the future? If so, it might be a good idea, to remove it from the example documentation (such as on http://www.digitalmars.com/d/declaration.html#alias), to prevent new users from using it. PS - Sorry if I'm stating the obvious. |
January 03, 2004 Re: DMD 0.77 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeroen van Bemmel | Jeroen van Bemmel wrote:
>About pragma's: couldn't these be implemented using versioning functionality
>instead?
>
>Each compiler defines an identifier as its version already, and proprietary
>extensions would then have to be enclosed in such version sections.
>For example:
>
>version (DigitalMars) {
> __some_proprietary_keyword__ int x;
>} else {
> int x;
>}
>
>Reasoning behind this: I tend to prefer minimalistic feature sets
>
>
>
>
I think version and pragma are quite different beasts. One is like a compile-time "if statement" while the other is like a compile time enable/disable. What may be useful is if you can use versioning to determine if a pragma is enabled or not (or if it's in a particular state).
pragma(ident);
version (ident)
{
//ident is enabled
}
|
January 03, 2004 Re: DMD 0.77 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to J Anderson | "J Anderson" <REMOVEanderson@badmama.com.au> wrote in message news:bt6jc4$flc$1@digitaldaemon.com... | Walter wrote: | | >o No more instance keyword (though still supported for the time being). | >To instantiate template Foo with arguments a,b use: | > | > | Does this imply that your going to remove the instance keyword some time | in the future? | | If so, it might be a good idea, to remove it from the example | documentation (such as on | http://www.digitalmars.com/d/declaration.html#alias), to prevent new | users from using it. | | PS - Sorry if I'm stating the obvious. | Also it should be removed from error messages. This code: class A(T) { T b; this(T _b) { b=_b; } } void main() { A!(int) a = new A!(3); } Produces this message: "instance A(3) does not match any template declaration". Also, if I change the assignment to "new A!;" (wrong, obviously), dmd crashes. ----------------------- Carlos Santander Bernal |
January 03, 2004 Re: DMD 0.77 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | How Great! Typeof properties and new features of templates are what I've been waiting for. BTW, though class templates can be very easily declared, function templates, alias templates, etc. are not. I think that template declaration like C++ is useful for the sake. template(T) T max(T a, T b) { return a > b ? a : b; } It also looks like an attribute. |
Copyright © 1999-2021 by the D Language Foundation