What is nothrow for?
Yigal Chripun
yigal100 at gmail.com
Fri Apr 25 10:08:23 PDT 2008
janderson wrote:
>
> While attributes are a nice idea for somethings; for things like
> invariants it would make the client syntax more difficult to read. Also
> invariant const etc.. could not go into the standard lib because then
> the compiler would make it much more difficult for the compiler to
> perform optimizations (Walters point 2).
>
> Also it would be more difficult to extend the concept of invariants; for
> example, to something like functional programming because of attribute
> system limitations.
>
> If your moving something like invariants to attributes, don't forget
> your not actually reducing the complexity to the end user. Now they
> have to figure-out what the standard lib is doing also. The complexity
> only reduces for the compiler writer.
>
> -Joel
Regarding optimizations, I don't know if it would be possible with
attributes - I guess it depends on the compiler APIs exposed to the
attribute writer. I do agree that not _all_things_ should be implemented
as attributes. The invariants are a bad example and I just used that to
illustrate how complex the D syntax has become.
It's like the type system - D provides a a set of built in primitive
types like int,char,long,etc.. and a way to use those to create your own
via classes/unions/structs...
so it may make sense to have a built-in const but IMO nothrow doesn't
deserve the same status. I'm also not sure that pure should be provided
by D.
Look at the link bellow for a Java DBC using annotations. Seems much
better than what D provides (nothing.. since it's not implemented).
Since D is not backed up by a giant like Sun/MS/Google/etc it makes
sense to delegate these features to the community, since it's obvious
not high on Walter's todo list and annotations make perfect sense for that.
Note, you mention "attribute system limitations" - since D does have
that system yet, we do not know what limitations D's system would have
compared to the .net or Java implementations.
http://en.wikipedia.org/wiki/Java_Modeling_Language
More information about the Digitalmars-d
mailing list