April 17, 2012 Re: Aquivalent References as in C++? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | Another idea: instead scope, "in" can get a new functionality. Instead as a synonym for "const" it could mean "not null" for objects. |
April 17, 2012 Re: Aquivalent References as in C++? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | Namespace:
> Another idea: instead scope, "in" can get a new functionality. Instead as a synonym for "const" it could mean "not null" for objects.
Note that currently in D2 "in" means "scope const".
Bye,
bearophile
|
April 18, 2012 Re: Aquivalent References as in C++? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Tuesday, 17 April 2012 at 23:56:12 UTC, bearophile wrote:
> Namespace:
>> Another idea: instead scope, "in" can get a new functionality. Instead as a synonym for "const" it could mean "not null" for objects.
>
> Note that currently in D2 "in" means "scope const".
>
> Bye,
> bearophile
Yes I know. But the importand fact is that it's only a shorthand, you could use it for something more meaningful.
I only want to point out how important this content is to me.
Many user in other languages are wishing for a non-null reference keyword (e.g. Java, C#). So why should D don't give a solution?
But i think, i'm probably the only one in D who really wants something like that.
|
April 18, 2012 Re: Aquivalent References as in C++? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | Namespace: > But i think, i'm probably the only one in D who really wants something like that. I have discussed this topic three or more times, and opened an enhancement request around 2010-08-02: http://d.puremagic.com/issues/show_bug.cgi?id=4571 Bye, bearophile |
April 18, 2012 Re: Aquivalent References as in C++? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Wednesday, 18 April 2012 at 11:36:30 UTC, bearophile wrote:
> Namespace:
>
>> But i think, i'm probably the only one in D who really wants something like that.
>
> I have discussed this topic three or more times, and opened an enhancement request around 2010-08-02:
> http://d.puremagic.com/issues/show_bug.cgi?id=4571
>
> Bye,
> bearophile
That is incredible. What are the reasons against such implementation?
I will open a new topic to discuss about that again.
|
February 22, 2013 Re: Aquivalent References as in C++? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Wednesday, 18 April 2012 at 11:36:30 UTC, bearophile wrote:
> Namespace:
>
>> But i think, i'm probably the only one in D who really wants something like that.
>
> I have discussed this topic three or more times, and opened an enhancement request around 2010-08-02:
> http://d.puremagic.com/issues/show_bug.cgi?id=4571
>
> Bye,
> bearophile
It really would be great to get this fixed. I do consider it "broken" right now, considering that @safe is supposed to (from all the docs I've read on it) make your program incapable of using pointers incorrectly, etc.
Also, the argument that C++ doesn't provide a better guarantee with references seems highly flawed, since it's deliberately using pointers to make the case that references are broken. If you make a point of using references everywhere, C++ is *MUCH* better at this.
|
Copyright © 1999-2021 by the D Language Foundation