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

change deprecated String type to AbstractString as per 0.4 spec #1447

Merged
merged 2 commits into from
Oct 10, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions julia.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ false
1 < 2 < 3 # => true
2 < 3 < 2 # => false

# Strings are created with "
# AbstractStrings are created with "
Copy link
Collaborator

Choose a reason for hiding this comment

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

uhm, care to explain a bit though? It's very surprising

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's the link to the rationale

JuliaLang/julia#8872

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a bit -1 on this line itself being changed, because it's so confusing. If you want to keep this one change, care to add a "(Julia's basic string type" note or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you're right, that is confusing as a first sighting for string in julia. I'll clarify it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made a few changes, thoughts?

"This is a string."

# Character literals are written with '
Expand Down Expand Up @@ -314,7 +314,7 @@ end


# For loops iterate over iterables.
# Iterable types include Range, Array, Set, Dict, and String.
# Iterable types include Range, Array, Set, Dict, and AbstractString.
for animal=["dog", "cat", "mouse"]
println("$animal is a mammal")
# You can use $ to interpolate variables or expression into strings
Expand Down Expand Up @@ -550,13 +550,13 @@ super(Any) # => Any
# <: is the subtyping operator
type Lion <: Cat # Lion is a subtype of Cat
mane_color
roar::String
roar::AbstractString
end

# You can define more constructors for your type
# Just define a function of the same name as the type
# and call an existing constructor to get a value of the correct type
Lion(roar::String) = Lion("green",roar)
Lion(roar::AbstractString) = Lion("green",roar)
# This is an outer constructor because it's outside the type definition

type Panther <: Cat # Panther is also a subtype of Cat
Expand Down