Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-constant variable initializers #8

Open
MartinNowak opened this issue Feb 12, 2014 · 2 comments
Open

Allow non-constant variable initializers #8

MartinNowak opened this issue Feb 12, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@MartinNowak
Copy link
Collaborator

At module scope variable declarations only have constant initializers.
To support auto seed = unpredictableSeed() the corresponding module should be rewritten like so.

module _mod2;
import _mod0, _mod1;

typeof(unpredictableSeed()) seed;

shared static this()
{
    seed = unpredictableSeed();
}
@callumenator
Copy link
Contributor

I had some issue with this in dabble, i.e.:

input: auto a = appender!string;
re-write: typeof(appender!string) a; // error: expression (appender!string) has no type

I ended up using lambdas to deduce the type:

typeof( (()=>(appender!string))() )

@MartinNowak
Copy link
Collaborator Author

Thanks, good to know.
I thought that remaining property differences for typeof were already fixed, but they aren't.

@MartinNowak MartinNowak added this to the 0.1.1 milestone Feb 17, 2014
@MartinNowak MartinNowak self-assigned this Feb 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants