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

deprecate &x syntax in ccall, replace with Ref #6080

Closed
pygy opened this issue Mar 7, 2014 · 15 comments
Closed

deprecate &x syntax in ccall, replace with Ref #6080

pygy opened this issue Mar 7, 2014 · 15 comments
Assignees
Labels
breaking This change will break code deprecation This change introduces or involves a deprecation needs decision A decision on this change is needed parser Language parsing and surface syntax
Milestone

Comments

@pygy
Copy link
Contributor

pygy commented Mar 7, 2014

|(::String) = 4
# | (generic function with 49 methods)

&(::String) = 6
# ERROR: syntax: invalid identifier name "::"

|(123,456)
#507

&(123,456)
# ERROR: unsupported or misplaced expression &

Base.(:&) works as intended.

@StefanKarpinski
Copy link
Member

You need to put parens around some operators to use them in prefix form. I forget why this is, but it is the case for some operators and it's not a bug.

@pygy
Copy link
Contributor Author

pygy commented Mar 7, 2014

It's surprising that only some of them work without the parens. If it's not a bug, so be it.

I'm curious about the reason, though.

@StefanKarpinski
Copy link
Member

It's because & as a unary operator is a special syntax that has meaning for ccall arguments. Since that's a very niche situation, however, I wonder if we couldn't allow prefix usage of the & function elsewhere.

@pygy
Copy link
Contributor Author

pygy commented Mar 8, 2014

You could mandate the parentheses for prefix & calls in ccall expressions, but not everywhere else.

The ccall section of the manual already documents special & syntax in that contex, a remark about prefix & calls could be appended to that paragraph.

@JeffBezanson JeffBezanson added the parser Language parsing and surface syntax label Mar 16, 2015
@JeffBezanson
Copy link
Member

Now that an alternative is available, we need to decide whether to fully deprecate & syntax in ccall.

@tkelman
Copy link
Contributor

tkelman commented Sep 14, 2016

There's still a performance cost to using Ref in ccall right? Guess that needs fixing before & in ccall can be deprecated without performance regressions.

@StefanKarpinski
Copy link
Member

There was a change to use Ref in the LAPACK wrappers and it was way too slow. I believe that performance issue is the blocker from completely removing the use of & in ccall.

@JeffBezanson
Copy link
Member

#11402

@vtjnash vtjnash removed this from the 0.6.0 milestone Dec 22, 2016
@vtjnash
Copy link
Member

vtjnash commented Dec 22, 2016

need to deprecate & in ccall first, which is probably mostly pending #18632 right now (although that's not required for making this efficient – only need the easy case of #8134)

@JeffBezanson JeffBezanson added this to the 1.0 milestone May 2, 2017
@JeffBezanson JeffBezanson added the deprecation This change introduces or involves a deprecation label May 2, 2017
@JeffBezanson JeffBezanson changed the title Error using the ampersand in function definitions and prefix function calls. deprecate &x syntax in ccall, replace with Ref May 2, 2017
@JeffBezanson
Copy link
Member

#22684 and #22734 will enable this.

@yuyichao
Copy link
Contributor

Ah, so here's the issue..... Somehow I couldn't find this when openning the two prs....

@musm
Copy link
Contributor

musm commented Jul 28, 2017

#22684 has been merged 👍 so the only thing left here is to update base definitions that use & and add a deprecation ?

@StefanKarpinski
Copy link
Member

Yeah, I think so. There was a PR for this, but it may be easier to just do it from scratch. Do you want to tackle this, @musm? If so, that would be great.

@JeffBezanson JeffBezanson removed their assignment Aug 17, 2017
@musm
Copy link
Contributor

musm commented Aug 21, 2017

@StefanKarpinski I am working on this

@JeffBezanson
Copy link
Member

Deprecation is in for 0.7. For 1.0, we should change the parsing of &x to a call expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code deprecation This change introduces or involves a deprecation needs decision A decision on this change is needed parser Language parsing and surface syntax
Projects
None yet
Development

No branches or pull requests

8 participants