--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
is kotlin experiencing any of this, considering it is, at least from my viewpoint, scala without implicits?given that it is "intellij idea only" for now, shouldn't it be bashed even more?
what i would do if i invented scala and wanted to protect it is to prepare a few pages containing "hard numbers" or statements from happy companies and simply putting links the prepared pages into every discussion where "scala sucks" is mentioned, and tell my minions to do the sameGesendet: Montag, 02. Dezember 2013 um 10:32 Uhr
Von: "martin odersky" <martin....@epfl.ch>
An: scala-debate <scala-...@googlegroups.com>
Cc: scala-internals <scala-i...@googlegroups.com>
Betreff: [scala-debate] Another Scala rant on HN
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
It is a good news that a topic about Scala makes the Hacker news frontpage.It means much people know and care about Scala, even some of them said do not like it or that.I'm working in the same company as the poster.These opinion are stand for some in company, but not most (maybe most of them are watching).We also have many success Scala projects.
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
I also work in the same company as the poster. We are currently running a huge Scala/Play project where the team is a mix of many young developers (< 5 yrs) and a few seniors. Overall it is a very pleasant experience. There are multiple other projects using Scala which share this positive feeling.It is difficult to explain these reactions, but they are common among my colleagues. These are senior programmers who are generally very good with any programming language/task. They will pickup something new and be productive in just a few days. They usually end up liking Ruby, Javascript, Clojure and for good reasons.
Hi Martin,I'm quite new to Scala and am taking the reactive course. I love everything about the language and also the direction where its headed. However, maybe I can contribute with some criticism from a "new user" standpoint without any bashing:1. Promote the improved incremental compile times better:From what I've read online on HN etc, you've lost many enterprise users since those are the ones that tend to work on large code bases and could not deal with the long compile times. They left maybe 1-3 years ago from what I can tell. I've only ever used sbt 0.13 and my compile times are incredibly fast. I think it would help if there was an in-depth (blog?) post on scala-lang.org showing that the compile times have massively improved. Right now, many people (including me) simply reply to comments regarding compile times with "check out the latest version". It would be much better if there was a link-able post showing the recent improvements.
Grzegorz,If Maven/Gradle can benefit from these improvements thru Zinc then make sure you emphasize on this too.This will attract many Java developers right away!
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
If only we had Hindley Milner type inference to enable our monads, then they'd come across!
To me, such rants along with things like http://vimeo.com/64716826 lack technical substance in so many points, and it is a sign that Scala threats their worlds and fear that they will be forced in working on Scala by their companies ... and they are simply not willing to learn it ... they may not like syntax, they may simply not like functional programming ... the list is endless and largely biased. There is no perfect language and people really like prejudices.Marius
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
With posts like this, it's not even worth it for you to get worked up about it at all, much less to try replying rationally. Sadly, this is just a product of the success of Scala and there's not much you can do about it other than just keep working on making Scala as good as you can possibly make it. As somebody above said, "haters gonna hate."Sure, it's worth noting the valid criticisms and trying to fix them, but if you let yourself get caught up in any of these "debates" you end up in a lose-lose situation where you come out looking defensive, arrogant, resistant to change, etc...I started programming in Java professionally in 1998 and I remember going through very much this same sort of crap. Sure, Java had its warts, but it was leaps and bounds better than most of the other options out there. I still had to listen to people trying to tell me that Perl was a better solution to build a webapp or something.There are still people on the internet who try to bash Java as being slow, just because they heard that once or maybe tried writing an applet 8 years ago and had problems with it. People just like to bash things, especially things that aren't whatever they've chosen to be their favorite tool and/or things they don't understand.Scala is an awesome language and I've seen a lot of people make the transition from various languages (Java, Ruby, Python) and almost all of them like it better because it manages to combine the best of these worlds. I could never imagine going back to Java and, in fact, I've turned down a few very interesting job prospects simply because they were Java shops and didn't seem open to going to Scala.There are a lot of things that could be fixed about Scala, but you know the vast majority of them and a good portion of them are being actively worked on. The best response to anything like this is just to rise above it and be as awesome as possible.
:: atomly ::
[ ato...@atomly.com : www.atomly.com : http://blog.atomly.com/ ...
[ atomiq records : new york city : +1.347.692.8661 ...
[ e-mail atomly-new...@atomly.com for atomly info and updates ...
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I don't think we've done enough to define scala in the public mind, so there's a lot of room for each critic to redefine it. I'd encourage a focus on clarifying the scala message(s) and getting the word out.Being at the center of the debate is a great thing. Let's use that attention to spread the word and to build the tribe.
Wow, I just lost a lot of respect for you right there @MartinOdersky...
Of course I'm nobody, so there's little reason why you should care about me personally .. but please do take the time to contrast your reaction to that of other well-known language creators.
Bjarne Stroustrup, (you know, the guy who actually created the language that Scala is being compared to) had enough modesty to admit that given the constraints, the way C++ evolved was the best he could do, by saying things like "There are only two kinds of languages: the ones people complain about and the ones nobody uses" and "Within C++, there is a much smaller and cleaner language struggling to get out. "
Rich Hickey had enough decency to advise the Clojure community not to engage in language wars by saying "I would very much like to discourage the bashing of other languages
here." and trying to keep the discussion on properties of Clojure.
Guido van Rossum has appealed to his community to try and work together with the Ruby people, rather than look down on them. (You see, contrary to your beliefs, there's quite a bit of bashing going on between Ruby and Python people.)
Unlike their reactions (targeted at trying to calm their communities down), your post is pretty much a call to arms.. That does seem an awful lot immature. I expected better from the creator of Scala.
> And even though those communities would normally never mix, they find common ground in the opinion that Scala is a horrible language
Yeah, it's not like there's generally a broad group of programmers (across various languages) to be found to hate on one particular language .. like say for PHP or Java or JavaScript .. or, you know, C++ ..
Stop victimizing yourself, stop blaming others, and man up. Because in contrast to all those other languages in that list above, Scala seems to be proving Bjarne wrong, as it is a language that people both complain about and don't use.
No, in fact I am not getting worked up about this, and certainly do not intend to enter the debate :-) The reason I wrote the post on this mailing list is not the specific blog post but the fact that there's s series of them and that they all got upvoted vigorously. That's interesting, because other languages do not get the same "attention". I was speculating what might be the reason, that's all.
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
Unlike their reactions (targeted at trying to calm their communities down), your post is pretty much a call to arms..
That does seem an awful lot immature. I expected better from the creator of Scala.
Yeah, it's not like there's generally a broad group of programmers (across various languages) to be found to hate on one particular language .. like say for PHP or Java or JavaScript .. or, you know, C++ ..
Stop victimizing yourself, stop blaming others, and man up. Because in contrast to all those other languages in that list above, Scala seems to be proving Bjarne wrong, as it is a language that people both complain about and don't use.
What I see, trying to teach Scala to a medium sized team of Java developers (20) and learn more myself from some Scala and Functional Programming experts:
" we have fixed the IDEs (thank you IntelliJ and Eclipse teams!) so thisis no longer that much of an issue."Yes, things are better! No, this is not done, keep up the good work and keep making the IDE and compiler faster. A few battles have been won, but the war is not over. The poor performance and bugs in ScalaIDE have lead almost half the developers here to IntelliJ from Eclipse (but it has other issues). I'll leave the details of that for the appropriate mailing list.
On Mon, Dec 2, 2013 at 5:10 PM, Simon Ochsenreither <simon.och...@gmail.com> wrote:
I think Andy is spot on. I have also mentioned it a few times in the past, but progress is pretty slow because everyone is busy with dozens of other important tasks.
Currently, we are just not where we should be in terms of beginner-friendly documentation, short articles about specific topic, blog posts on scala-lang.org etc.
I think it is the major, non-technical obstacle to wider adoption and I'm surprised that Typesafe doesn't see any benefit of having a dedicated person which would solely focus on improving documentation on all fronts, day in, day out. That would, imho, be a amazingly good investment and a major win for Typesafe, its customers, the community and people interested in learning the language.
Agreed that better documentation would be great. There is a problem in finding the right person to do it. Engineers are often not very good at documenting, or do not like it so much, and technical writers are quickly out of their depth. We'd need to find a knowledgeable person who likes to do these kinds of things. Who would be able to fund this is another question, but given the right person we can think about that next.
Agreed that better documentation would be great. There is a problem in finding the right person to do it. Engineers are often not very good at documenting, or do not like it so much, and technical writers are quickly out of their depth. We'd need to find a knowledgeable person who likes to do these kinds of things. Who would be able to fund this is another question, but given the right person we can think about that next.
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
--
+1══════════════════════════════════════════════► Twitter: @ziodave---► InsideOut10 s.r.l. (IT-11381771002)══════════════════════════════════════════════
--
You received this message because you are subscribed to a topic in the Google Groups "scala-debate" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-debate/153H3Ya4Nxk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scala-debate...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
> A lesser criticism is that it might introduce more questions about why there is more than one way of doing the same thing
I don't think that's a lesser criticism; having multiple ways to do the same thing is a big source of confusion for new people, both from a "what does this do" PoV, as well as from a "so... which one should I use?" PoV.Personally I would prefer having to annotate the symbolic name with an @name("...") annotation, then both names will always be in the same place, the "convention" can be enforced and relied upon by both IDE and programmer. #bikeshedding
In general, for-comprehensions need some syntactic cleanup. "_ = println(...)" should *not* be an acceptable state of affairs! That's the type of thing makes people go WTF at first glance!
> Inconsistencies like these, which are really minor for me, should maybe be viewed as more significant problems which undermine a new Scala programmer's confidence in the language. But before we start thinking about ways of fixing them, we should decide what our most fundamentally invariant and universal syntax "rules" should be.+1. Although I use Scala a lot, and think the middleware/core is really awesome, I feel the superficial syntax is full of odd cruft.- for comprehension braces/parens- bare statements (e.g. println) in for comprehensions needing _ = println()- def x = {} v.s. def x{} (thanks @soc for championing this deprecation!)- m1.map(x => x + 1), but m2.map{case (x, y) => (x+1, y+2)}.- def f() = ... methods being called via just "f". That introduces a bunch of inconsistency where "a method defined with N parameter lists is called with M=N parameter lists, except when N = 1 then M=0 or M=1 and you need to put _ after the name (???) to not immediately eval it".
- If I def f(i: Int)(j: Int): Int and call f(10), the compiler should know very well I'll get a (Int => Int) back; why should I need to put a _ after? Target typing fixes this in some cases, but it also makes the situations where I *have* to put the _ unpredictable and seemingly random.
Other languages have far more rigid "this is the way to write things" philosophy, so even if the language grammar ranges from bigger (e.g. Java) to ridiculously complicated (C#) to weirdly rigid (Python) the code is far more "predictable" at first glance.I remember asking Nine ways to define a method in Scala when I was learning it two years ago. It wasn't so much the "flexibility to add braces or define anonymous functions anywhere" thing that tripped me up, but the x = {} vs x{}, and def f() being called with just "f" features. These turned what could have been a predictable pattern of behavior into a seemingly random jumble. I totally can imagine people being scared off, I know I almost was.
I'm an entrepreneur bootstrapping my first startup. We are using Scala and Play and love both. I have been a Java programmer for a number of years and have only started using FP earlier this year. The way we use Scala is very straightforward - we mostly use case classes/pattern matching, map, flatMap and filter on collections (mostly just Lists and Maps), Options and Futures. Our code reads like a children's book. Together with Play (just starting to use Akka explicitly now) and a couple of plugins, that covers 90% of our needs.What I think could be done is to put more focus on Scala-related success stories in well-known technology companies. There is a page on the Typesafe website that lists some of them: http://typesafe.com/company/casestudies, but they leave out most major companies using Scala (even if they don't use the entire Typesafe stack): Twitter, Foursquare, LinkedIn, Tumblr, Klout... These are companies that needed both great scalability and expressiveness and in several cases they switched from another language/stack to scala.Twitter has done a great job of explaining how they use Scala and to give back to the open source community with things like Finagle, but I think it would be great to have a series on how each of these companies tackled their specific problems and how Scala has helped them get there. It would certainly strike a chord with the HN audience.
Martin and folks,There is a lot of great discussion here, and I'm late to the thread. But I'd like to add some support for BOTH the "Scala Is Hard" folks and the "Scala Is Great" folks. Since I think both are true in some sense.In one context or another, I've programmed since around 1974, and I learned more than a dozen languages and used at least 9 extensively on the job. (I've even programmed Forth for money! :-)My general approach is to learn enough of a language to get started with solving a problem, and then get more into the details - the nooks and crannies as it were - as I use the language over time. So when I heard about Scala a couple of years ago, I took the same approach. I read a good chunk of Martin's book, and I loved what I found, so I used Scala to write a new version of a problematic production subsystem, and integrated it with the rest of our Java code. I used the basic language syntax, and Actors, and some of the functional programming features of the language. I liked the language, I liked the efficiency of the syntax, I liked the result, and it worked like a charm. But, I must admit, I did not read ALL of Martin's book, or all of the other book I bought. Looking around the web I saw some complicated looking Scala code, and basically just ignored it. Anyway, I was a Scala convert. And started telling good developers I knew about my experience.I got distracted by non-coding stuff and iOS programming right after that.A short time later I ran into a "Scala is Hard" post. My first reaction was something along the lines of "Really? That's weird, I didn't think it was so hard..." But that prompted me to get back to Scala and look at the bits I had not gotten around to before. And then I had my "Holy Cow!" moment. There is some complicated stuff in there! And after working on better understanding and making more extensive use of the type system and the like, I did get the feeling that, relatively speaking, Scala was more "complex" and "harder" in some sense then the other languages I had used.
The point is that even though I really liked Scala, I had sympathy for those who felt is was hard - or perhaps even too hard or not worth it. The conclusion I came to was that:- I wanted to use it- I would not worry about the "harder stuff", which I would learn over time or not at all- I would not ask less capable folks on the team to use itNow it is a couple of jobs later, and we are starting with some greenfield development. We have a team of mixed skill levels. So I've been starting to mull over my Scala strategy.- Use it and try to get everyone on board?- Encourage the really awesome dude we just hired to use it, and give other folks the option?- Not use it and wait for Java to get hip?- Maybe it's time to get back into Groovy...Honestly, I'm not sure at this point, but I've got to make a decision soon. So...This is a very timely discussion, I must say! I appreciate everyone taking the time to give their intelligent and carefully considered opinions.Brian
On Monday, December 2, 2013 2:32:15 AM UTC-7, Martin wrote:
Seems hardly a weekend goes by these days without another Scala rant that makes the Hacker news frontpage.This week-end's edition is called "Scala - 1 Star - would not program again", and it's by someone who from reading his post seems to have written Scala all of two weeks after coming form Javascript. I think the interesting bit is not so much that these posts are written, but that they are upvoted so much.
--You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Now it is a couple of jobs later, and we are starting with some greenfield development. We have a team of mixed skill levels. So I've been starting to mull over my Scala strategy.- Use it and try to get everyone on board?- Encourage the really awesome dude we just hired to use it, and give other folks the option?- Not use it and wait for Java to get hip?- Maybe it's time to get back into Groovy...Honestly, I'm not sure at this point, but I've got to make a decision soon. So...
For instance, people might find structural types hard (or not).
If we try to dumb down the language, the way its presented, and the community in order to cater to stubborn minds, we'll end up with neither a smart language nor a thoughtful community.
+ we should do something about operators. I like James Ward's idea to mandate an alphabetic alias for every operator - at least people would know how to pronounce them then.
I would be OK with providing an annotation people could optionally use to give a name to a symbol, which could pop up in IDEs when someone hovers the mouse over the symbol. But I wouldn't mandate it and certainly wouldn't recommend people make aliases. My take is that if the meaning a symbol is obvious to your users, it just adds clutter to the design to also provide an alphabetic alias. Otherwise, the symbol is non-obvious, and you should probably *only* provide an alphabetic name and not use a symbol.
I would like to second this comment. The advertised USP of Scala seems to be that is a OO/FP language, but it's not clear what benefit one would get from that.I've been doing Scala professionally for 1.5 years, I was very excited about it in the beginning and I am thankful to it for introducing me to Haskell (I did a lot of Java before)I understand the notion of a bridge between OO and FP but the problem with that is that a bridge is for crossing, not to dwell on.
C# added the most obviously useful FP features packaged nicely in delegates , LINQ and Async to not trouble the OO world view.Scala seems like Java and Haskell smashed together and one needs to pick the pieces that fit their mental model, and ignore the rest as bloat.
Martin says there's something good in have a full blown, kitchen sink OO/FP language. But it's never quite explained why.
Martin says there's something good in have a full blown, kitchen sink OO/FP language. But it's never quite explained why.
I like both Haskell and Java for their purity and constraint of design in their respective worlds.Why is it a good idea to throw inheritance (subclassing), implicits, variance and type classes in the same language ? These things clash together in nightmarish ways.
Martin says there's something good in have a full blown, kitchen sink OO/FP language. But it's never quite explained why.
Imho, the difference between C# and F# is that the Scala is content with having a good OOP/mediocre FP language (C#) or a mediocre OOP/good FP language (F#). There is just no reason why better OOP has to mean worse FP, or the other way around and I think Scala has already shown that it hasn't to be this way.
You're right should have not used F# as an example, as that has subclassing as well. In my (relatively non-specialist view) a lot of the disjointness in Scala comes from the nice little FP language hiding in there clashing with inheritance and variance.Basically I just want Haskell on JVM with strictness by default and possibly limited, local mutability to allow for non-observable determinism.I don't need all the OO abstract classes/partially implemented traits/layer cake monstrosities, and no one actually manages to explain why they are a good idea particularly when combined with a nice clean FP language that's struggling to get out.
I think you might be missing my point. C# has it's warts but it at least has a clear goal in mind which is to be a good OO language with a sprinkle of FP features. Similarly F# is has a goal of being an FP language.
Martin says there's something good in have a full blown, kitchen sink OO/FP language. But it's never quite explained why.
Imho, the difference between C# and F# is that the Scala is content with having a good OOP/mediocre FP language (C#) or a mediocre OOP/good FP language (F#). There is just no reason why better OOP has to mean worse FP, or the other way around and I think Scala has already shown that it hasn't to be this way.
You're right should have not used F# as an example, as that has subclassing as well. In my (relatively non-specialist view) a lot of the disjointness in Scala comes from the nice little FP language hiding in there clashing with inheritance and variance.
Basically I just want Haskell on JVM with strictness by default and possibly limited, local mutability to allow for non-observable determinism.
I don't need all the OO abstract classes/partially implemented traits/layer cake monstrosities, and no one actually manages to explain why they are a good idea particularly when combined with a nice clean FP language that's struggling to get out.
I don't mind dynamic and async as a feature, but I much prefer this being done as a macro like in scala instead of putting lots of features into the core language before it is clear that they pull their weight.
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
You're right should have not used F# as an example, as that has subclassing as well. In my (relatively non-specialist view) a lot of the disjointness in Scala comes from the nice little FP language hiding in there clashing with inheritance and variance.
Basically I just want Haskell on JVM with strictness by default and possibly limited, local mutability to allow for non-observable determinism.
Can someone explain why we need implementation inheritance in Scala ? I did 15 years of Java and learned that's the worst part of it.Marrying the OO and FP world essentially means shoving subclassing in the nice clean FP world view ? What's the point of this ?I had high hopes for Scala but I don't understand this insistence on traditional OO being a good thing. I thought everyone agreed by now that it's a good idea to separate interface and implementation.I know about Frege, Akka, all that. My question is exactly this: while it's possible to marry OO and FP, no one manages to explain why is it seen as good idea in the first place ?
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
How would you any useful work in Scala without mixing in traits?Higher-order functions, ADTs, type classes. You know, modern FP
As for my thoughts, what Scala is really missing for me is syntactic regularity in the punctuation. I'm constantly tripping on what needs a colon, a brace, an _, backticks, an extra set of parentheses, a =>, a ->, a semicolon, def/val, etc.
Scalaz uses quite a bit of mixin composition. It is used in a different way than is common in typical OO. But it seems that mixin compostion is useful even for a library that is considered "modern FP" by most people.
Can someone explain why we need implementation inheritance in Scala ? I did 15 years of Java and learned that's the worst part of it.
Marrying the OO and FP world essentially means shoving subclassing in the nice clean FP world view ? What's the point of this ?
I had high hopes for Scala but I don't understand this insistence on traditional OO being a good thing.
I thought everyone agreed by now that it's a good idea to separate interface and implementation.
I know about Frege, Akka, all that. My question is exactly this: while it's possible to marry OO and FP, no one manages to explain why is it seen as good idea in the first place ?
BankAccountBusinessService (is-a) HttpServer (is-a) DBConnection (is-a) Logger
Thanks Jon, I think you completely get where I'm coming from.To Rex, the situation really isn't as simple as you describe it. I don't know the language all that well, so I could be wrong on some of these points, but many of the things you point out actually do have additional wrinkles that you don't have to dig too far to encounter. Or if there is a consistency to be found, it can still be rather subtle or surprising, perhaps due to lack of analogy with similar looking languages. The sum total of these is a feeling of unpredictability.
- Type ascription needs a colon. That's the only time you use a single colon.
Sure, but it's not always intuitive to know when you actually need to use type ascription. A lot of times, I realize I'm missing a necessary colon (and attached type annotation) after being signaled by a IDE error highlight.
- Braces go anywhere you have multiple statements. (Irregularity: you can use parens for a for-comprehension instead.)
Yet sometimes they are also used to group things that aren't statements, like case statements and for clauses. And I don't really know if I'm interpreting this correctly, but it seems like they can also double as parentheses, to make it look like a thunk is simply setting next to a method? Like Future { 5 }
- _ goes anywhere you mean "whatever", whether it's an unnamed function argument, an unspecified type, an import of everything, or arguments you'll fill in later.
Underscore is waaay overloaded. Plus it's rather strangely used to for partial application of functions.
- Backticks are only needed when you're trying to use a reserved word as an identifier. That's the only time you use it.
And also needed to defeat magical interpretation of case clauses when it's not the desired effect.
- You never need to use an extra set of parentheses. (Irregularity: sometimes you can omit parens and sometimes you can't.)
Because a tuple and argument list are two different things, sometimes, it feels like you do. And when the norm is to omit the parentheses, it makes it feel like using them is in fact the special case. This also applies to method invocation.
- => means a function, both with types (TypeA => TypeB) and values (x => f(x)). (Exception: imports use => for renaming.)
=> is also used for call-by-name parameters. Speaking of which, since call-by-name isn't necessarily visible at the place-of-call (if you're not looking at an inline method signature), it can make unfamiliar code behave in counterintuitive ways.
- -> is an alternate builder for Tuple2. That's the only time you use it.
I would question whether this actually adds to the usefulness of the language versus the regularity of leaving out this special case. And I when I wrote it, I also had in mind <-, which is obviously a different token, but has a totally unrelated use.
- Semicolons are only used when you need to separate statements on the same line. (Rare exception: occasionally semicolon inference gets confused. It's been a year since it last did for me.)
I'll grant you that one. I just threw semicolon in the mix to make it seem more overwhelming :)
- def creates a method; val creates an un-reassignable value. Always. (Exception: case classes let you omit the val in the constructor.)
Plenty of examples I've seen declare vals in traits, but implement them as defsAlso, I forgot the . and how you can leave it off to get infix syntax. As cool as that is, I find I usually end up having to just use typical dot notation to get things correct. Some might consider the implicit "this." within class scope to be another place where context is implied. I realize of course that Java shares this usage.I'm probably factually wrong on a couple of these points, but I know I'm not wrong on all of them. My overall point is that we're not taking crazy pills, those of us who find these issues vexing and productivity-sapping. I think there's a real and significant but totally addressable problem here. But it's only addressable if experts are willing to give up some of the slickness they've obviously grown to love.
Hi Haoyi,
The upper-/lower-case rule in pattern matching is weird because it's only seen in pattern matching, and it appears to elevate something which is otherwise only a convention (capitalization of type names, lower-case for value identifiers) to a strict feature, in just this isolated case.
A language feature which maybe falls into the same category is sealed-trait scope; nowhere else in the Scala language does the file have such relevance.
It does have an impact on binding precedence (although we think the spec and implementation differ on exactly what that is.)
Could this also be solved by having two keywords - case for the first, bind for the second, maybe?
I'm also pretty familiar with Scala. My gut says sure, making types *have* to start with capital letters works fine. On the other hand, I don't think it solves the problem here. The problem is if i have:
- or bind a value to the identifier `a` and shadow the old one.
Shadowing warnings are something that's often been mooted, but which I've never seen implemented (this is the cue for someone to tell me it's in trunk, behind an -X parameter...).
Surely I'm not the only one who sees the problem with BankAccountBusinessService being able to *override* HttpServer.send , DBConnection open/close, Logger.log, etc.
The way traits are commonly used in Scala is very different from e. g. interfaces in Java.
Yes they are, unfortunately...
But that's a conscious decision you make, surely? If you wanted to (for example) log all HttpServer.sends, you could just writeoverride def send(whatever: Any) = {log.info("Doing an HTTP send")super.send(whatever)}
Yes, you could very well write that, but it violates everything that the OO community has learned over the years, like, separation of concerns for one.The fact that is so easy to do that and in fact, actively encouraged by the Scala community is what baffles me.
Yes they are, unfortunately...I do actually disagree with Simon very slightly here (unusually!). Usage of traits in Scala isn't that much different from interfaces in Java, there are just a few additional uses of traits in Scala which arise from their flexibility that wouldn't make sense in Java.
Their flexibility just seems to make the wrong things easy. And people use it and it ends up being the 10 deep multiple inheritance hierarchy with 100 methods all public that call up and down across the hierarchy.
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
To Rex, the situation really isn't as simple as you describe it.
- Type ascription needs a colon. That's the only time you use a single colon.
Sure, but it's not always intuitive to know when you actually need to use type ascription.
- Braces go anywhere you have multiple statements. (Irregularity: you can use parens for a for-comprehension instead.)
Yet sometimes they are also used to group things that aren't statements, like case statements and for clauses. And I don't really know if I'm interpreting this correctly, but it seems like they can also double as parentheses, to make it look like a thunk is simply setting next to a method? Like Future { 5 }
- _ goes anywhere you mean "whatever", whether it's an unnamed function argument, an unspecified type, an import of everything, or arguments you'll fill in later.
Underscore is waaay overloaded. Plus it's rather strangely used to for partial application of functions.
- Backticks are only needed when you're trying to use a reserved word as an identifier. That's the only time you use it.
And also needed to defeat magical interpretation of case clauses when it's not the desired effect.
- You never need to use an extra set of parentheses. (Irregularity: sometimes you can omit parens and sometimes you can't.)
Because a tuple and argument list are two different things, sometimes, it feels like you do.
- => means a function, both with types (TypeA => TypeB) and values (x => f(x)). (Exception: imports use => for renaming.)
=> is also used for call-by-name parameters
- -> is an alternate builder for Tuple2. That's the only time you use it.
I would question whether this actually adds to the usefulness of the language versus the regularity of leaving out this special case.
And I when I wrote it, I also had in mind <-, which is obviously a different token, but has a totally unrelated use.
- def creates a method; val creates an un-reassignable value. Always. (Exception: case classes let you omit the val in the constructor.)
Plenty of examples I've seen declare vals in traits, but implement them as defs
Also, I forgot the . and how you can leave it off to get infix syntax.
On Wed, Dec 4, 2013 at 8:15 PM, Alan Johnson <lla...@gmail.com> wrote:
- -> is an alternate builder for Tuple2. That's the only time you use it.
I would question whether this actually adds to the usefulness of the language versus the regularity of leaving out this special case.I use it all the time when creating maps. I used to not, but then I noticed that it really clarifies where my key-value pairs are.And I when I wrote it, I also had in mind <-, which is obviously a different token, but has a totally unrelated use.I agree this is bad--in particular that <- and => are in some sense opposites of each other. Of course <= means something else, but I think the more consistent usage would be <- and ->. I'd be willing to give up the map-pair functionality for that (or use a different symbol like <>).
I agree this is bad--in particular that <- and => are in some sense opposites of each other. Of course <= means something else, but I think the more consistent usage would be <- and ->. I'd be willing to give up the map-pair functionality for that (or use a different symbol like <>).
Yes, you could very well write that, but it violates everything that the OO community has learned over the years, like, separation of concerns for one.
The fact that is so easy to do that and in fact, actively encouraged by the Scala community is what baffles me.
Their flexibility just seems to make the wrong things easy. And people use it and it ends up being the 10 deep multiple inheritance hierarchy with 100 methods all public that call up and down across the hierarchy.
In my opinion, what we actually want is a slightly-more-syntax-rich pattern matcher. Although more syntax is generally a bad thing, shoving multiple cases into the same syntax distinguished by some arbitrary thing (i.e. capitalization) is terrible. One idea is to have "@" be a syntax to check against values, so you could do:
I'm just going to add this and go back to my day job :) There's a lot of debate around minor syntax quirks. Also I noticed Martin quiz on syntax size.
The tyranny of choice if you like. Even this discussion about traits is relevant: is it an interface, an abstract class, a mixin, all of that and more ?
A good programming language in my view is one that encourages good abstractions. When I sit down and model the world I want to implement I'm now faced with the options: is this a interface trait, a mixin trait, an abstract, an actual class, maybe a type class ?That's what scares people off, not whether to type semicolons or not.
So based on this, here's my suggestion to make Scala 3.0 the true language of the future (and allow it to have a chance to compete with Java 8)- create a typeclass (or type class) a first class concept - i.e. make it a keyword- make type class type function parameters behave like implicit parameters- deprecate implicits entirelyEventually get rid of inheritance completely, when the above becomes popular enough
But things have evolved to be the way they are because they have been shown to work well for enough people that they've become part of the language, and stayed part of the language. We can keep tweaking the ideas, and there's a lot of benefit to doing so, but the hours and days and weeks of thought the designers of Scala have put into the language are being undermined by the suggestion that things like implicits are an inherently terrible idea...
Cheers,Jon
--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-debate...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
Scaladoc has caught up--you just have to pass it the right options.
On Dec 5, 2013 7:54 AM, "Rex Kerr" <ich...@gmail.com> wrote:
>
> On Wed, Dec 4, 2013 at 8:15 PM, Alan Johnson <lla...@gmail.com> wrote:
>>
>>
>> To Rex, the situation really isn't as simple as you describe it.
>
>
> You're right; I'd forgotten some additional special cases. Neither is it as complex as you describe it, but I agree that you and Jon have pointed out plenty of wrinkles that could use some ironing.
>
>>
>>
>> - Type ascription needs a colon. That's the only time you use a single colon.
>>
>> Sure, but it's not always intuitive to know when you actually need to use type ascription.
>
>
> Agreed. But this isn't the colon's fault. It's not related to the language syntax at all, but rather the capabilities of type inference. Put another way: there is no possible way you could change the syntax of ascribing a type that would make this any better. It's a deeper issue, alas.
>
>>
>>
>> - Braces go anywhere you have multiple statements. (Irregularity: you can use parens for a for-comprehension instead.)
>>
>> Yet sometimes they are also used to group things that aren't statements, like case statements and for clauses. And I don't really know if I'm interpreting this correctly, but it seems like they can also double as parentheses, to make it look like a thunk is simply setting next to a method? Like Future { 5 }
>
>
> I view this as "case statements act like multiple statements", but I agree that's also an irregularity. Braces work anywhere you _could_ have multiple statements, and Scala lets you omit parens if you use braces (since ({ blah }) doesn't really clarify anything) so rather than being a special case, I think it's actually very consistent...but it's consistently flexible. Having more than one way to do something typically makes it harder for a newcomer until they are comfortable enough with the language to appreciate when the different styles help clarify rather than confuse matters. It's definitely a tradeoff.
>
>>
>>
>> - _ goes anywhere you mean "whatever", whether it's an unnamed function argument, an unspecified type, an import of everything, or arguments you'll fill in later.
>>
>> Underscore is waaay overloaded. Plus it's rather strangely used to for partial application of functions.
>
>
> The details are tricky, but the "whatever-everything" meme works surprisingly well. Partial application of functions _is_ a kind of "whatever-everything" that you do to a function.
>
>>
>>
>> - Backticks are only needed when you're trying to use a reserved word as an identifier. That's the only time you use it.
>>
>> And also needed to defeat magical interpretation of case clauses when it's not the desired effect.
>
>
> Oops. I'd forgotten about that. Agreed, that is a bit of a jarring overload. I almost never use this for that reason
I don't see it as an overload -- backticks mean "force this text to be seen as an identifier." Not parsed otherwise, and not a bind variable.
Well maybe I'm wrong because
val `yield` = 1
doesn't act like a pattern match, even though you can have a pattern in that position.
>
>>
>>
>> - You never need to use an extra set of parentheses. (Irregularity: sometimes you can omit parens and sometimes you can't.)
>>
>> Because a tuple and argument list are two different things, sometimes, it feels like you do.
>
>
> Agreed. One way or another it's irregular.
>
>>
>>
>> - => means a function, both with types (TypeA => TypeB) and values (x => f(x)). (Exception: imports use => for renaming.)
>>
>> => is also used for call-by-name parameters
>
>
> Which are just Function0 with some syntactic sugar to make them look like they aren't. I've never gotten any mileage out of thinking of call-by-name parameters as anything other than Function0s. To avoid surprises, an IDE that highlights them appropriately can be useful.
>
>>
>>
>> - -> is an alternate builder for Tuple2. That's the only time you use it.
>>
>> I would question whether this actually adds to the usefulness of the language versus the regularity of leaving out this special case.
>
>
> I use it all the time when creating maps. I used to not, but then I noticed that it really clarifies where my key-value pairs are.
>
>>
>> And I when I wrote it, I also had in mind <-, which is obviously a different token, but has a totally unrelated use.
>
>
> I agree this is bad--in particular that <- and => are in some sense opposites of each other. Of course <= means something else, but I think the more consistent usage would be <- and ->. I'd be willing to give up the map-pair functionality for that (or use a different symbol like <>).
>
>>
>>
>> - def creates a method; val creates an un-reassignable value. Always. (Exception: case classes let you omit the val in the constructor.)
>>
>>
>> Plenty of examples I've seen declare vals in traits, but implement them as defs
>
>
> Other way around; a val can stand in for a def since that's one perfectly reasonable way to get the result of a no-argument function: just read a value. This isn't a syntactic issue.
>
>>
>>
>> Also, I forgot the . and how you can leave it off to get infix syntax.
>
>
> Like with { 5 } vs. (5), this is flexibility not inconsistency (in that you can choose to do it either way, rather than being forced to sometimes do it one way and sometimes the other).
>
> It took me some time to develop the intuition for where point-free syntax looks cleaner and still works. There is more to say about this than I have time to write right now, but in a sense it's a price (or opportunity?) we pay for having minimal distinctions between operators and methods. I agree that it is not beneficial for ease of learning.
>
> --Rex
>
>
On Dec 5, 2013 7:54 AM, "Rex Kerr" <ich...@gmail.com> wrote:
>
If -> meant function like in Haskell, and => meant making like in php etc., it would take care of all these concerns.
>
>>
>>
>> - def creates a method; val creates an un-reassignable value. Always. (Exception: case classes let you omit the val in the constructor.)
>>
>>
>> Plenty of examples I've seen declare vals in traits, but implement them as defs
>
>
> Other way around; a val can stand in for a def since that's one perfectly reasonable way to get the result of a no-argument function: just read a value. This isn't a syntactic issue.
>
>>
>>
>> Also, I forgot the . and how you can leave it off to get infix syntax.
>
>
> Like with { 5 } vs. (5), this is flexibility not inconsistency (in that you can choose to do it either way, rather than being forced to sometimes do it one way and sometimes the other).
>
> It took me some time to develop the intuition for where point-free syntax looks cleaner and still works. There is more to say about this than I have time to write right now, but in a sense it's a price (or opportunity?) we pay for having minimal distinctions between operators and methods. I agree that it is not beneficial for ease of learning.
>
> --Rex
>
>
Not so different. Remember how for comprehension desugar.
--
On Dec 5, 2013 8:30 AM, "Cristian" <cristian...@googlemail.com> wrote:
>
>
>
>
> I'm just going to add this and go back to my day job :) There's a lot of debate around minor syntax quirks. Also I noticed Martin quiz on syntax size.
>
> I think this misses the point entirely of what people mean by complexity. It's not complexity of syntax, it's complexity of concepts.
>
> The tyranny of choice if you like. Even this discussion about traits is relevant: is it an interface, an abstract class, a mixin, all of that and more ?
>
> A good programming language in my view is one that encourages good abstractions.
The problem is that what's a good selection of abstractions in one person's experience usually turns out to be limiting in other situations. That's the great thing about Scala -- you have much more freedom in choosing appropriate abstractions. But of course that is a huge tradeoff.
When I sit down and model the world I want to implement I'm now faced with the options: is this a interface trait, a mixin trait, an abstract, an actual class, maybe a type class ?
>
> That's what scares people off, not whether to type semicolons or not.
>
> On Thursday, December 5, 2013 12:43:44 PM UTC, Matthew Pocock wrote:
>>
>> I am very pleased that 2.10 gained syntax to make type classes easier to work with (implicit classes etc.) and hope the scaladoc catches up.
>>
>
> So based on this, here's my suggestion to make Scala 3.0 the true language of the future (and allow it to have a chance to compete with Java 8)
>
> - create a typeclass (or type class) a first class concept - i.e. make it a keyword
> - make type class type function parameters behave like implicit parameters
> - deprecate implicits entirely
>
> Eventually get rid of inheritance completely, when the above becomes popular enough
>