You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have mixed feelings (leaning towards negative) about the extensive use of infix notation in the book for code like:
circle(10) beside square(20) beside square(30)
my impression is that the Scala community experimented with this style pretty heavily for a long time, but in recent years almost everyone has retreated from it and it's not really a mainstream style anymore for ordinary, alphanumerically-named methods like beside
but my concern isn't only about what the dominant style is in the community, it's also about what an appropriate style for getting started with the language is. for years now, I've seen (on Gitter and IRC, primarily) beginners tripping themselves up with what this syntax means and how it is parsed. beginners end up using a mishmash of spaces and dots and parens and not really knowing what's going on and where infix is permitted and when it isn't and when you need parens to make it work and when you don't. it seems like a distraction to me. by sticking with a.b(c) style you bypass all these issues, freeing up mental energy to focus on more important things
would a PR changing the code to consistently use this style instead:
circle(10).beside(square(20)).beside(square(30))
be welcome...?
The text was updated successfully, but these errors were encountered:
(we're at ScalaBridge Montreal right now, @ironfish had the same reaction, that this syntax shouldn't be used to start with, or if it is used, should at least be explained as being equivalent to normal method call syntax)
I have mixed feelings (leaning towards negative) about the extensive use of infix notation in the book for code like:
my impression is that the Scala community experimented with this style pretty heavily for a long time, but in recent years almost everyone has retreated from it and it's not really a mainstream style anymore for ordinary, alphanumerically-named methods like
beside
but my concern isn't only about what the dominant style is in the community, it's also about what an appropriate style for getting started with the language is. for years now, I've seen (on Gitter and IRC, primarily) beginners tripping themselves up with what this syntax means and how it is parsed. beginners end up using a mishmash of spaces and dots and parens and not really knowing what's going on and where infix is permitted and when it isn't and when you need parens to make it work and when you don't. it seems like a distraction to me. by sticking with
a.b(c)
style you bypass all these issues, freeing up mental energy to focus on more important thingswould a PR changing the code to consistently use this style instead:
be welcome...?
The text was updated successfully, but these errors were encountered: