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

Add at-TypedDict macro #8

Closed
wants to merge 1 commit into from
Closed

Add at-TypedDict macro #8

wants to merge 1 commit into from

Conversation

tonyhffong
Copy link

No description provided.

@tonyhffong
Copy link
Author

@StefanKarpinski @simonster , anyone ?
I start thinking I'm proposing something really dumb ...

@stevengj
Copy link
Member

Looks good to me. We definitely need something like this.

@StefanKarpinski
Copy link
Member

This seems fine to me. Does the syntax seem good – first pair is the types?

@simonster
Copy link
Member

Maybe this ship has already sailed on this, but I wonder whether it might be better to have a macro that just makes the 0.4 syntax work everywhere, so you'd write:

@compat Dict(a=>1, b=>2)

or something like that. AFAICT this can still be parsed on 0.3.

@StefanKarpinski
Copy link
Member

Seems hard to implement since that's then one huge @compat macro.

@stevengj
Copy link
Member

Doesn't seem that bad to me... the @compat macro could call subsidiary functions, after all. (It could dispatch on the first symbol it encounters.)

In the present case, I'd prefer Compat.Dict{Foo,Bar}(foo=>bar), but that is not a valid macro syntax. @simonster's proposal, however, would allow @compat Dict{Foo,Bar}(foo=>bar)

@simonster
Copy link
Member

I'm not too concerned about having one huge @compat macro unless we're making a huge number of breaking changes in a single release. But we could also have one macro per feature, i.e. @Compat.dict Dict(a => 1), @Compat.dict AnyDict(a => 1), and @Compat.dict Dict{K,V}(a => 1). It's only a little more verbose, the syntax is closer to the real 0.4 syntax, and you can just remove the macros once 0.4 is out.

@stevengj
Copy link
Member

I would strongly prefer a single @compat macro.

@StefanKarpinski
Copy link
Member

Why?

@stevengj
Copy link
Member

Because it is much clearer, shorter, and easier to remember: you use the Julia-master syntax, and just stick @compat in front. And when backwards compatibility is no longer necessary, you just delete @compat.

It also has the virtue of acclimating the programmer to the Julia-master syntax, as well as being instructional for anyone reading the code.

@StefanKarpinski
Copy link
Member

Those are all good reasons. Seems like the way to go.

simonster added a commit that referenced this pull request Oct 15, 2014
@tonyhffong
Copy link
Author

That's much better. I'm closing this one. Thanks.

@tonyhffong tonyhffong closed this Oct 16, 2014
simonster added a commit that referenced this pull request Oct 16, 2014
simonster added a commit that referenced this pull request Oct 16, 2014
stevengj added a commit that referenced this pull request Oct 16, 2014
Add @compat as discussed in #8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants