struct vs. class, int vs. char.

grauzone none at example.net
Tue Apr 28 11:50:28 PDT 2009


> I belive it could be implemented as a library type, using Scope(T) template:

I don't like that approach to replace random language features by 
templates at all. And in this case, you really have to ask WHY?

It's nice that it's possible, but there are some reasons that speak 
against this approach:
1. it's harder to understand in general (even if the language definition 
becomes smaller)
2. error messages turn into an incomprehensible mess
3. puts more stress on the compiler and it gets slower (you will 
understand when you have to _wait_ for your project to finish 
compilation, even if you use the superfast dmd)

> class Foo
> {
>     Scope!(Bar) _bar;
> }

Would typeof(_bar) == Bar?

> Perphaps, Phobos could provide that functionality, then we could deprecate "scope Foo foo = new Foo(args);" in favor of "auto foo = Scope!(Foo)(args);" and eventually remove from language.



More information about the Digitalmars-d mailing list