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

deprecated symbol(x...) becomes Symbol(x...) #15995

Closed
wants to merge 10 commits into from
Closed

deprecated symbol(x...) becomes Symbol(x...) #15995

wants to merge 10 commits into from

Conversation

jeffreysarnoff-dev
Copy link

This renaming follows Julia's capitalization of named Types and their constructors.
This pull request should reflect edits to deprecate.jl and expr.jl.

This renaming follows Julia's capitalization of named Types and their constructors.
This renaming follows Julia's capitalization of named Types and their constructors.
@yuyichao
Copy link
Contributor

I believe you need to update the def of Symbol.

@JeffBezanson
Copy link
Sponsor Member

👍

Yes, there are many uses of symbol that will need to be updated, and the definitions in base/expr.jl should be switched to add methods to Symbol.

@nalimilan
Copy link
Member

@jeffreysarnoff-dev If you wonder why tests failed, deprecation warnings are turned into failures in Travis/AppVeyor.

@jeffreysarnoff-dev
Copy link
Author

I had changed the the methods in base/expr.jl -- Somehow that file did not get included with the pull request. Please close this pull request. I will process all the source files locally to catch each use of 'symbol' and put the changes into a new fork then resubmit the request. Thank you.

@nalimilan
Copy link
Member

We can leave this PR open, and just force-push when you're ready.

@jeffreysarnoff-dev
Copy link
Author

jeffreysarnoff-dev commented Apr 23, 2016

I have pushed changes to ~67 files (.jl, .md, .rst) relative to ./julia (above /julia/base):
(recursively) replace "symbol(" with "Symbol(" then replace "_Symbol(" with "_symbol".
I see this branch as https://github.com/jeffreysarnoff-dev/julia/tree/patch-3

@nalimilan
Copy link
Member

Looks good. Unfortunately, changes to the same code areas have been merged into master since you forked. Could you rebase on master and fix conflicts? You should also squash into a single commit.

@jeffreysarnoff-dev
Copy link
Author

jeffreysarnoff-dev commented Apr 23, 2016

@nalimilan Now that I know how to do it, I can redo it as a single commit to a current fork. It is much easier to do that than to fiddle with conflicts (I have not done that before) and combining multiple commits into one (which did not work for me last time).
Unless you tell me otherwise .. I am going to delete my patch-3 branch on my fork, delete my fork, refork and create a branch called patch-3 then single commit symbol(x...) --> Symbol(x...).
[If I am not permitted to delete and recreate patch-3 on my fork I will try rebasing it from the current state of Julia and then do the rest. I would prefer not, as I have never fully trusted git's ability to understand what I want it to do through what I can ask it to do .]

@timholy
Copy link
Sponsor Member

timholy commented Apr 23, 2016

Whatever's easiest is fine. However, if you want to try to use git, do something like this:

git checkout -b patch-3a
git fetch                                  # update origin/master
git rebase -i origin/master
# Now edit the TODO list, using "pick" for the first and "squash" for the rest
# Save and close the file
# Fix any merge conficts
git rebase --continue
git push myfork +patch-3a:/patch-3  # force-push local branch patch-3a to remote branch patch-3

where myfork is the name of your remote (e.g., jeffreysarnof-dev).

@@ -264,7 +264,7 @@ A_mul_B!(y::AbstractArray, p::ScaledPlan, x::AbstractArray) =
# or odd).

for f in (:brfft, :irfft)
pf = symbol(string("plan_", f))
pf = Symbol(string("plan_", f))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that usages like this should probably be replaced with Symbol("plan_", f).

@stevengj
Copy link
Member

(Good to take this opportunity to clean up a lot of the Symbol calls to remove extraneous calls to string etcetera.)

@nalimilan
Copy link
Member

Note that all improvements noted by @stevengj would better stay in a separate commit, so that one commit only does the systematic renaming.

@jeffreysarnoff-dev
Copy link
Author

symbol( --> Symbol then _Symbol( --> _symbol then deprecated.jl done in one commit

@jeffreysarnoff-dev
Copy link
Author

@jeffreysarnoff-dev
Copy link
Author

I just noticed that I forgot to include the pull request number in deprecated.jl.
I don`t know how to change that in the same commit -- if you do, please do.
Otherwise, tell me to do it over again.

@nalimilan
Copy link
Member

@JeffreySarnoff Just make the changes, then git commit -a --amend to add this change to the last commit. But you should either push your changes here or open a new PR, as currently the changes are only on the branch.

@jeffreysarnoff-dev
Copy link
Author

fixed. should be good to go.

@JeffreySarnoff
Copy link
Contributor

thank you -- done

On Mon, Apr 25, 2016 at 10:19 AM, Milan Bouchet-Valat <
[email protected]> wrote:

@JeffreySarnoff https://github.com/JeffreySarnoff Just make the
changes, then git commit -a --amend to add this change to the last
commit. But you should either push your changes here or open a new PR, as
currently the changes are only on the branch.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#15995 (comment)

@nalimilan
Copy link
Member

Sorry, there are still conflicts with master. See how many commits are included in this branch. If that's easier, open a new clean PR.

Also, do you plan to address @stevengj's enhancements while you're at it?

@jeffreysarnoff-dev
Copy link
Author

I will use a new PR and a new branch -- I can address @stevenj's enhancements, are you saying 1 PR two commits or 2 PRs?

@nalimilan
Copy link
Member

1 PR, 2 commits is the best solution.

@nalimilan
Copy link
Member

Closing in favor of #16038.

@nalimilan nalimilan closed this Apr 25, 2016
hayd added a commit to hayd/julia that referenced this pull request May 1, 2016
@@ -29,7 +29,7 @@ convert(::Type{Vector{UInt8}}, s::AbstractString) = bytestring(s).data
convert(::Type{Array{UInt8}}, s::AbstractString) = bytestring(s).data
convert(::Type{ByteString}, s::AbstractString) = bytestring(s)
convert(::Type{Vector{Char}}, s::AbstractString) = collect(s)
convert(::Type{Symbol}, s::AbstractString) = symbol(s)
convert(::Type{Symbol}, s::AbstractString) = Symbol(s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should remove this one. Calling the constructor from convert doesn't make sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing this line gave lots of errors! Presumably we're using this in quite a few places.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nalimilan Can you explain? The docs on constructors seems to suggest that Symbol(a) and convert(Symbol, a) should be equivalent. By default the constructor is defined in terms of convert, but in this case the implementation (that I could not find) seems to be in the constructor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant that we usually define convert and let the default constructor fall back to it, rather than the reverse. But in this case that seems to make sense.

hayd added a commit to hayd/julia that referenced this pull request May 1, 2016
hayd added a commit to hayd/julia that referenced this pull request May 1, 2016
hayd added a commit to hayd/julia that referenced this pull request May 1, 2016
hayd added a commit to hayd/julia that referenced this pull request May 1, 2016
symbol(s::ASCIIString) = symbol(s.data)
symbol(s::UTF8String) = symbol(s.data)
symbol(a::Array{UInt8,1}) =
Symbol(s::Symbol) = s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTOH this constructor is probably useless due to the fallback to convert.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this what's causing the method error(s) @tkelman noticed?

...but like I say removing the convert kills the build. :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @nalimilan said, the default constructor calls convert, not the other way around, so if you remove something it should be the constructor(s).

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.

None yet

9 participants