shared and getParameterStorageClasses bug?

Jean-Louis Leroy jl at
Tue Aug 25 12:52:14 UTC 2020

On Tuesday, 25 August 2020 at 07:16:39 UTC, Petar Kirov 
[ZombineDev] wrote:
> Interesting, so essentially, you need a good solution for your 
> refractParameter function, right? I'll try to check the code in 
> more detail later and think about it.

Actually it already works as is:

void original(lazy const Object);

enum edited =
   refract!(original, "original")
   .withParametersAt(0, Parameter("foo", "int"));

void expected(int, lazy const Object);
static assert(is(typeof(&copy) == typeof(&expected)));

The generated mixin is:

pragma(msg, edited.mixture);
// @system bolts.experimental.refraction.ReturnType!(original)
// copy(int foo, lazy 
bolts.experimental.refraction.Parameters!(original)[0] _0);

(In this case, Parameters!(original)[0..1] (note the ..) would 
have worked as well - and it would have looker better too. I'll 
implement that soon.)

Let's look at the function types:

pragma(msg, typeof(&original).stringof); // void function(lazy 
pragma(msg, typeof(&copy).stringof);     // void function(int 
foo, lazy const(Object) _0) @system

It looks like it is impossible to tell the difference between 
'const object' and 'const(Object)' - the substitution happens too 
early. So I guess it doesn't matter...

More information about the Digitalmars-d mailing list