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

many small tweaks to the Basics page #675

Merged
merged 3 commits into from
Feb 9, 2017
Merged

many small tweaks to the Basics page #675

merged 3 commits into from
Feb 9, 2017

Conversation

SethTisue
Copy link
Member

all of these changes are small, don't involve changing ordering,
and are hopefully not controversial.

@SethTisue
Copy link
Member Author

review by @shogowada and community

@SethTisue
Copy link
Member Author

SethTisue commented Feb 7, 2017

there are a few code blocks that don't compile, so I just left tut off of those. @tpolecat I wanted to use tut:failed for those, but it didn't work because the code blocks included valid entries as well as invalid entries, so tut complained that not everything in the block failed. is that working-as-designed...?

@tpolecat
Copy link

tpolecat commented Feb 7, 2017

@SethTisue "correct as implemented" … I think the surprisingly-named :nofail will do what you want.

@SethTisue
Copy link
Member Author

I think the surprisingly-named :nofail will do what you want

yeah but it's deprecated. let's discuss further at tpolecat/tut#141

val x = 1 + 1
println(x) // 2
println(x * x) // 4
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

@shogowada shogowada Feb 8, 2017

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

Copy link
Member Author

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.

@@ -90,33 +91,33 @@ println({

## Functions

Functions are expressions with parameters.
Functions are expressions that take parameters and compute a result.
Copy link
Contributor

@shogowada shogowada Feb 8, 2017

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"?

Copy link
Member Author

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.

Copy link
Contributor

@shogowada shogowada Feb 8, 2017

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.

Copy link
Member Author

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.

Copy link

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

@shogowada
Copy link
Contributor

Just for my knowledge, what does tut do? I couldn't find anything on the internet or on contributing page.

@SethTisue
Copy link
Member Author

SethTisue commented Feb 8, 2017

what does tut do?

see #591 and #593 (and https://github.com/tpolecat/tut)

oops, the readme should definitely explain this! I opened #677 on it

@SethTisue
Copy link
Member Author

Does anyone have any idea why Travis is failing? I just hit "restart" on the build a second time

@@ -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.
Copy link
Contributor

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).

Copy link
Member Author

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
@SethTisue
Copy link
Member Author

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

@SethTisue SethTisue merged commit c6d2f45 into scala:master Feb 9, 2017
@SethTisue SethTisue deleted the basics-tweaks branch February 9, 2017 17:47
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