-
Notifications
You must be signed in to change notification settings - Fork 1k
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
many small tweaks to the Basics page #675
Conversation
review by @shogowada and community |
there are a few code blocks that don't compile, so I just left |
@SethTisue "correct as implemented" … I think the surprisingly-named |
yeah but it's deprecated. let's discuss further at tpolecat/tut#141 |
tutorials/tour/basics.md
Outdated
val x = 1 + 1 | ||
println(x) // 2 | ||
println(x * x) // 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, it looks like it's adding unnecessary complication only to show that values hold results of expressions.
What's the reason for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted the example to have a reason to use val
, so we are illustrating not only the syntax, but also the use. With my change, introducing x
now avoids repeating a computation (namely, the adding of 1 and 1).
Maybe I'm overthinking this. I don't have a strong feeling about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
How about leaving this line as is and adding another example, maybe something like below?
You can reference values in other expressions, too.
val x = 1 + 1 println(x * 2) // 4 println(x * 3) // 6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just restore the original.
tutorials/tour/basics.md
Outdated
@@ -90,33 +91,33 @@ println({ | |||
|
|||
## Functions | |||
|
|||
Functions are expressions with parameters. | |||
Functions are expressions that take parameters and compute a result. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "compute a result" redundant with "Functions are expressions"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ummm... "expressions with parameters" just sounds funny to me. I would never say/write that. Does it mean "functions are values", or does it mean that the body of a function is an expression, or what?
I'm open to other suggestions than the one I've made, but I do think the original sentence is unclear and should be changed somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I think rephrasing it to "Functions are expressions that take parameters" is an improvement.
By saying "Functions are expressions with parameters", I tried to communicate that functions are, in essence, just expressions with parameters added to its scope. But I think "that take parameters" communicates it clearer.
I just thought, maybe, "and compute a result" is redundant because expressions always compute results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll use your suggested form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions have parameters and take arguments. It probably doesn't matter, but if you're keeping a running list of things that bug me there you go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a function application, are arguments applied to a function or the function to the arguments? Params and args can also be values or types. Functions also reject args when an application fails to typecheck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, I will just think of methods as something like functions.
Just for my knowledge, what does |
see #591 and #593 (and https://github.com/tpolecat/tut) oops, the readme should definitely explain this! I opened #677 on it |
Does anyone have any idea why Travis is failing? I just hit "restart" on the build a second time |
tutorials/tour/basics.md
Outdated
@@ -14,21 +14,21 @@ In this page, we will cover basics of Scala. | |||
|
|||
## Trying Scala in the Browser | |||
|
|||
You can run Scala in your browser by using [ScalaFiddle](https://scalafiddle.io). | |||
You can run Scala in your browser with [ScalaFiddle](https://scalafiddle.io). | |||
|
|||
1. Go to https://scalafiddle.io. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also link the URL? Automatic link isn't working on the website.
1. Go to [https://scalafiddle.io](https://scalafiddle.io).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
all of these changes are small, don't involve changing ordering, and are hopefully not controversial.
including using tut:nofail for blocks with some correct, some incorrect entries. the "nofail" name is confusing, but it does what we need. it is deprecated at present, but may be un-deprecated in the future, so it's provisionally ok for us to use. for details, see tpolecat/tut#141
I've responded to all reviewer feedback. not sure what the Travis flakiness is, but so far it always eventually passes if you hit rebuild a few times, so I'm going to go ahead and merge, since this page is getting attention right now since Heather tweeted (and scala_lang retweeted) about it https://twitter.com/heathercmiller/status/829653981089714176 |
all of these changes are small, don't involve changing ordering,
and are hopefully not controversial.