With arrays and pointers, you can declare
const(int[]) constData;
immutable(int[]) immutableData;
to enforce constancy constraints. The type modifiers apply both to the reference to the
data and to the data being referenced. If you want to be able to change what data the
variables
I'm pretty sure there's a dmd pull request or
patch or something for this already.
IIRC Michel Fortin implemented it as Object ref obj;
(which is the same as Object obj;) and const(Object) ref obj;
as tail const.
Don't know where it is now though...
On Wednesday, 28 March 2012 at 14:11:10 UTC, Adam D. Ruppe wrote:
I'm pretty sure there's a dmd pull request or
patch or something for this already.
IIRC Michel Fortin implemented it as Object ref obj;
(which is the same as Object obj;) and const(Object) ref obj;
as tail const.
Don't know
Stewart Gordon:
OK, so we have std.typecons.Rebindable. But I've found it a
PITA when it comes to generic programming. Among other things,
if you try to pass it around, you can end up with a mess like
const(Rebindable!(const())). This wouldn't happen with
built-in tail const support.
Stewart Gordon, el 28 de marzo a las 14:54 me escribiste:
What do people think to the whole idea?
I think this is not an announcement at all and shouldn't be discussed in
this list :)
--
Leandro Lucarella (AKA luca) http://llucax.com.ar/
I'm not sure how my post ended up in .announce, but anyway
On 28/03/2012 15:24, bearophile wrote:
snip
Is it possible to invent a language construct that allows:
const(Rebindable!(const()))
To be defined as the same as:
Rebindable!(const())
You mean be defined the same as
On 28/03/2012 16:09, Stewart Gordon wrote:
snip
Something like an onConst()/onImmutable templated methods for structs/classes?
snip
I'm not sure whether this would be a good idea. And it would solve only one of
Rebindable's many shortcomings
Moreover, any feature that makes a type a