been hampered primarily by Scala's dependencies on the JVM
I love Scala. It is my favorite programming language, among the 15 or so I've had the pleasure and/or pain of writing code in. The problem is, I can't use it in the places I want to use it - like the browser, or in a mobile app (outside of Android of course).
Should there be talk of a long term project to eliminate or reduce Scala's dependencies on the JVM or JVM libraries, so that it would be much easier to write compiler plugins to output something that could be used on a non-JVM formats like JavaScript or .Net or LLVM? At the very least, it might lower the barrier of entry for these non-JVM runtime targets.
(1) .NET. The JVM works just fine on every machine I know of where .NET works at all. So you can certainly use Scala on the hardware. Maybe you need an interoperability layer to existing .NET stuff, but that's different (and should be considerably easier) than jettisoning all traces of Java/JVM dependence from Scala.
(2) LLVM. Why? The JVM is highly optimized for what it (and Scala, for the most part) needs. You already can call native code with JNA and JNI.
(3) JavaScript. Many key advantages of Scala (e.g. type safety, performance) are lost by going to JavaScript as an intermediate, and most anything that runs JavaScript could now or will soon be able to run a JVM as well/instead. Rather than doing lots of work to end up with an improved but ultimately sub-standard solution, why not instead try to get the JVM to work in more places? Between Dalvik and the Oracle JVM for ARM, there isn't much that seems out of reach.
On Sun, Oct 14, 2012 at 9:07 PM, sleepy daddy software <bell....@gmail.com> wrote:I love Scala. It is my favorite programming language, among the 15 or so I've had the pleasure and/or pain of writing code in. The problem is, I can't use it in the places I want to use it - like the browser, or in a mobile app (outside of Android of course).
You can't use Java in the browser? I've been doing that since 1997.
Should there be talk of a long term project to eliminate or reduce Scala's dependencies on the JVM or JVM libraries, so that it would be much easier to write compiler plugins to output something that could be used on a non-JVM formats like JavaScript or .Net or LLVM? At the very least, it might lower the barrier of entry for these non-JVM runtime targets.
Personally, I think this is backwards. The JVM is already a great platform library. It's a bit heavyweight, which for the next couple of years will make it an awkward fit on smartphones, but basically we _already have the cross-platform tool you're talking about_. Making good cross-platform tools is hard work, and I'd rather have Scala development efforts go towards doing what Scala does uniquely well, not retreading the "let's make it cross-platform, too, for my favorite definition of platform!" road that has been walked so many times before, usually unsuccessfully.
Let's ask about the solution in each case.
(1) .NET. The JVM works just fine on every machine I know of where .NET works at all. So you can certainly use Scala on the hardware. Maybe you need an interoperability layer to existing .NET stuff, but that's different (and should be considerably easier) than jettisoning all traces of Java/JVM dependence from Scala.
(2) LLVM. Why? The JVM is highly optimized for what it (and Scala, for the most part) needs. You already can call native code with JNA and JNI.
(3) JavaScript. Many key advantages of Scala (e.g. type safety, performance) are lost by going to JavaScript as an intermediate, and most anything that runs JavaScript could now or will soon be able to run a JVM as well/instead. Rather than doing lots of work to end up with an improved but ultimately sub-standard solution, why not instead try to get the JVM to work in more places? Between Dalvik and the Oracle JVM for ARM, there isn't much that seems out of reach.
So although it is nice to know that Scala is not in principle wholly dependent on the JVM and Java libraries, in practice I don't think trying to divorce them is a good use of effort. It's a _huge_ amount of work, and then you put yourself in the position of having to chase a bunch of different developments, giving you a much higher ongoing maintenance cost.
In the very long term, if Scala becomes one of the top handful of languages, I could see something like this happening. Right now, I think using other more general tools as bridges (like GWT) is by far the most effective way to go. (And if Scala does become that popular, I think it's at least as likely that browsers will pick up the JVM as a core part of their functionality than that Scala will end up running well on a JavaScript engine.)
--Rex
The web has moved on. You cannot use the Java plugin on any mobile browser, even on Android, and there is zero chance that this will be added in the future. If I proposed a new enterprise application web application that required a browser plugin, I would be laughed at, then probably fired.
See my comments below:
On Monday, October 15, 2012 11:17:36 AM UTC-4, Rex Kerr wrote:
On Sun, Oct 14, 2012 at 9:07 PM, sleepy daddy software <bell....@gmail.com> wrote:I love Scala. It is my favorite programming language, among the 15 or so I've had the pleasure and/or pain of writing code in. The problem is, I can't use it in the places I want to use it - like the browser, or in a mobile app (outside of Android of course).
You can't use Java in the browser? I've been doing that since 1997.The web has moved on. You cannot use the Java plugin on any mobile browser, even on Android, and there is zero chance that this will be added in the future. If I proposed a new enterprise application web application that required a browser plugin, I would be laughed at, then probably fired.
Should there be talk of a long term project to eliminate or reduce Scala's dependencies on the JVM or JVM libraries, so that it would be much easier to write compiler plugins to output something that could be used on a non-JVM formats like JavaScript or .Net or LLVM? At the very least, it might lower the barrier of entry for these non-JVM runtime targets.
Personally, I think this is backwards. The JVM is already a great platform library. It's a bit heavyweight, which for the next couple of years will make it an awkward fit on smartphones, but basically we _already have the cross-platform tool you're talking about_. Making good cross-platform tools is hard work, and I'd rather have Scala development efforts go towards doing what Scala does uniquely well, not retreading the "let's make it cross-platform, too, for my favorite definition of platform!" road that has been walked so many times before, usually unsuccessfully.
Let's ask about the solution in each case.
(1) .NET. The JVM works just fine on every machine I know of where .NET works at all. So you can certainly use Scala on the hardware. Maybe you need an interoperability layer to existing .NET stuff, but that's different (and should be considerably easier) than jettisoning all traces of Java/JVM dependence from Scala.
I can't use Scala for windows 8 store applications, windows phone applications, netduino applications, SQL Server CLR code, ASP.NET applications, WPF applications, etc.... I could go on.
If they're compelling enough, a scala compiler extension for them will be written and maintained by the community. But these projects need some help, which is what I'm proposing we do.
(3) JavaScript. Many key advantages of Scala (e.g. type safety, performance) are lost by going to JavaScript as an intermediate, and most anything that runs JavaScript could now or will soon be able to run a JVM as well/instead. Rather than doing lots of work to end up with an improved but ultimately sub-standard solution, why not instead try to get the JVM to work in more places? Between Dalvik and the Oracle JVM for ARM, there isn't much that seems out of reach.
See my response earlier to your comment on the Java plugin. This is not true. If you are targeting android native development, you get an easy route to use scala code because android happens to support the JDK in its dalvik runtime. This is great, but this is a completely different thing from open web development.
Also, type safety is a feature of the language, not the runtime. When you compile scala to java bytecode, you lose information. You lose even more information when that bytecode gets JIT compiled to machine code. In the case of a JavaScript targeting scala compiler, it would be generating JavaScript as if it were a kind of high level assembly language, complete with Chrome-compatible javascript source maps so you can debug your scala code right in the browser.
I agree that bridge tools are the best option in the short term. This discussion is explicitly about the long term future of scala, and in the long term I think we should be working towards transitioning away from these tools
Should there be talk of a long term project to eliminate or reduce Scala's dependencies on the JVM or JVM libraries, so that it would be much easier to write compiler plugins to output something that could be used on a non-JVM formats like JavaScript or .Net or LLVM? At the very least, it might lower the barrier of entry for these non-JVM runtime targets.
Well, fair enough. But they're a LOT of work. If people want to, I don't see why they shouldn't, but I don't think it should distract from core Scala development at this point.
I don't think you're thinking about this on the right timescale. If there were the manpower to make something big happen in a year or so, sure. But if you are talking about reallocating already scarce resources to this, I think the picture changes.
On Mon, Oct 15, 2012 at 12:09 PM, sleepy daddy software <bell....@gmail.com> wrote:See my comments below:
On Monday, October 15, 2012 11:17:36 AM UTC-4, Rex Kerr wrote:
On Sun, Oct 14, 2012 at 9:07 PM, sleepy daddy software <bell....@gmail.com> wrote:I love Scala. It is my favorite programming language, among the 15 or so I've had the pleasure and/or pain of writing code in. The problem is, I can't use it in the places I want to use it - like the browser, or in a mobile app (outside of Android of course).
You can't use Java in the browser? I've been doing that since 1997.The web has moved on. You cannot use the Java plugin on any mobile browser, even on Android, and there is zero chance that this will be added in the future. If I proposed a new enterprise application web application that required a browser plugin, I would be laughed at, then probably fired.
Oh, yes. And Objective-C is a dead language, by the way. Programming has moved on.
Except, oops.
If you have a killer application (i.e. that you are the favored language to write the killer applications for the killer devices), historical trends can reverse dramatically.
If you ask as a technical matter whether a modestly enhanced Java plugin is competitive with JavaScript capabilities and implementable on mobile devices available in a couple of years (or the highest end ones now), the answer is "yes"; in some ways it's probably better.
So, I advise being the killer app over changing the framework (and using generic tools like GWT in the meantime).
On Monday, October 15, 2012 12:55:39 PM UTC-4, Rex Kerr wrote:I don't think you're thinking about this on the right timescale. If there were the manpower to make something big happen in a year or so, sure. But if you are talking about reallocating already scarce resources to this, I think the picture changes.
On Mon, Oct 15, 2012 at 12:09 PM, sleepy daddy software <bell....@gmail.com> wrote:See my comments below:
On Monday, October 15, 2012 11:17:36 AM UTC-4, Rex Kerr wrote:
On Sun, Oct 14, 2012 at 9:07 PM, sleepy daddy software <bell....@gmail.com> wrote:I love Scala. It is my favorite programming language, among the 15 or so I've had the pleasure and/or pain of writing code in. The problem is, I can't use it in the places I want to use it - like the browser, or in a mobile app (outside of Android of course).
You can't use Java in the browser? I've been doing that since 1997.The web has moved on. You cannot use the Java plugin on any mobile browser, even on Android, and there is zero chance that this will be added in the future. If I proposed a new enterprise application web application that required a browser plugin, I would be laughed at, then probably fired.
Oh, yes. And Objective-C is a dead language, by the way. Programming has moved on.
Except, oops.
If you have a killer application (i.e. that you are the favored language to write the killer applications for the killer devices), historical trends can reverse dramatically.
If you ask as a technical matter whether a modestly enhanced Java plugin is competitive with JavaScript capabilities and implementable on mobile devices available in a couple of years (or the highest end ones now), the answer is "yes"; in some ways it's probably better.
So, I advise being the killer app over changing the framework (and using generic tools like GWT in the meantime).Objective-C did not become popular because it was the killer language, but because it was endorsed by Apple. Scala is not in a similar position. The Objective-C case shows that mobile/web app developers will use whatever tools are easily available for the target platforms. Mobile/web development will thrive for the next couple of years with or without Scala. Having the dependency of JVM only makes the cost of adopting Scala higher.
On Monday, October 15, 2012 12:55:39 PM UTC-4, Rex Kerr wrote:
Oh, yes. And Objective-C is a dead language, by the way. Programming has moved on.
Except, oops.
If you have a killer application (i.e. that you are the favored language to write the killer applications for the killer devices), historical trends can reverse dramatically.
Objective-C did not become popular because it was the killer language, but because it was endorsed by Apple. Scala is not in a similar position. The Objective-C case shows that mobile/web app developers will use whatever tools are easily available for the target platforms.
Mobile/web development will thrive for the next couple of years with or without Scala. Having the dependency of JVM only makes the cost of adopting Scala higher.
Sure, but the cost isn't _that_ high. The JVM just isn't that esoteric. Android's outselling iPhones by a large margin. If Scala becomes the Android-app-builder of choice, and people feel like porting, "Hey, let's just get the JVM working over there" is a pretty tempting alternative to "Hey, let's rewrite all the Java core libraries or throw away a huge chunk of our code".
I love Scala. It is my favorite programming language, among the 15 or so I've had the pleasure and/or pain of writing code in. The problem is, I can't use it in the places I want to use it - like the browser, or in a mobile app (outside of Android of course). I've followed the discussions thus far on side projects like Scala+GWT and Scala.NET which are meant to help push Scala into new places, but most of these efforts have thus far been hampered primarily by Scala's dependencies on the JVM. The most successful approaches in these two projects have been to use an existing java-to-* tool (IKVM for Scala.NET and GWT for Scala-to-JS) and hacking together a toolchain to make that tool do something it wasn't designed for originally.I could be wrong (likely, given I'm not an expert on compilers or language design), but it seems this indirect approach to getting scala onto a non-JVM runtime is not going to work reliably or optimally in the long term. It seems like directly translating scala to a target runtime format, using the full information available inside the scala compiler itself has the potential to be far more optimal than translating from java bytecode or some java-based intermediate representation (as was suggested for Scala+GWT). From the discussions I've read so far, it seems that Scala's dependencies on the JVM and the libraries therein make this route impossible, or at least very difficult.
Should there be talk of a long term project to eliminate or reduce Scala's dependencies on the JVM or JVM libraries, so that it would be much easier to write compiler plugins to output something that could be used on a non-JVM formats like JavaScript or .Net or LLVM? At the very least, it might lower the barrier of entry for these non-JVM runtime targets.
But why something like that never haven't happened to PyPy or Jython or IronPython or Mono or IronRuby or JRuby or LuaJIT or numerous implementations of common lisp or HipHop or ...? All of them do lag behind corresponding official implementation but that doesn't make them less useful. Your argument is seriously flawed.
But why something like that never haven't happened to PyPy or Jython or IronPython or Mono or IronRuby or JRuby or LuaJIT or numerous implementations of common lisp or HipHop or ...? All of them do lag behind corresponding official implementation but that doesn't make them less useful. Your argument is seriously flawed.
The main reasons why people often bring the subject of taking steps away from the JVM dependencies (and I did so myself before), is that they see limitations of the language consistency that are due to the JVM limitations.
If the main reason to pool scarce resources away from current Scala priorities,
is to enable Scala programming the in browser for mobile, I say don't bother. The small screens on mobile are conducive to the browser and most prefer to run a
I suppose Java and .NET are competing platforms, Microsoft is dying
I suppose Java and .NET are competing platforms...
What ever reason makes sense to have own VM to support the language better and also help the language evolve better.One area that can benefit is GC less operations and overall performance increase if the SVM is used.
For example, right now I am coding a new general purpose language Copute which compiles to Scala (finally getting out of the design and into implementation stage after being very ill most of 2012). The aim is fix some of Scala's rough edges, while simplifying typeclasses and make the std library based on functor and applicative, as well supporting enforced pure functional programming in a much less obtuse manner than Scalaz. I expect this to be the next mainstream GPL. And I as one person, am able to code it, because I am using the Xtext (Eclipse's EMF/TMF) framework for rapidly prototyping parsers and the IDE comes nearly for free (except the debugger). I wouldn't be able to do that without JVM and Java compatibility.
http://copute.com/dev/docs/Copute/ref/compiler/Xtext/
def apply(file: java.lang.Object): String = file match { case File(pkgs,items) => pkgs.foldLeft("")( (s,x) => s + (x match { case PackageChained(name) => "package " + name + "\n" }) ) + packageOrImportOrTypedefOrObject(items, "") }
apply(file): java.lang.Object String = IF file IS File(pkgs,items) DO { (FROM "" DO (_ + IF _1 IS PackageChained(name) DO "package " + name + "\n") IN pkgs) + packageOrImportOrTypedefOrObject(items, "") }
--
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.
Yeah I was expecting someone might show the clever way to use Scala's obscure coding constructs to pack it. Thank you.
On Sat, Sep 7, 2013 at 5:23 PM, Shelby <she...@coolpage.com> wrote:
Yeah I was expecting someone might show the clever way to use Scala's obscure coding constructs to pack it. Thank you.Could you please add some arguments as to what is "clever" and "obscure coding constructs"?(I could have packed it a lot if I wanted to sacrifice readability)
On Sunday, September 8, 2013 4:14:32 AM UTC+8, √iktor Klang wrote:
The Scala code isn't really neat and tidy.Compare against:def apply(file: java.lang.Object): String = {val File(pkgs, items) = file("" /: pkgs)({ case (str, PackageChained(name)) => s"${str}package ${name}\n" }) + packageOrImportOrTypedefOrObject(items, "")}
On Sunday, September 8, 2013 5:23:19 AM UTC+8, Shelby wrote:That link above apparently has his comments about Scala, also enumerates why he thinks functional programming languages such as Haskell will not likely gain mainstream adoption. Yet I am trying to address the reason he provided.
On Sunday, September 8, 2013 5:36:06 AM UTC+8, √iktor Klang wrote:On Sat, Sep 7, 2013 at 5:23 PM, Shelby <she...@coolpage.com> wrote:
Yeah I was expecting someone might show the clever way to use Scala's obscure coding constructs to pack it. Thank you.Could you please add some arguments as to what is "clever" and "obscure coding constructs"?(I could have packed it a lot if I wanted to sacrifice readability)On Sunday, September 8, 2013 4:14:32 AM UTC+8, √iktor Klang wrote:The Scala code isn't really neat and tidy.Compare against:def apply(file: java.lang.Object): String = {val File(pkgs, items) = file("" /: pkgs)({ case (str, PackageChained(name)) => s"${str}package ${name}\n" }) + packageOrImportOrTypedefOrObject(items, "")}That is the first time I have seen `/:` even I have been fiddling with Scala for more than 2 years on and off. I can surmise from the code that it is doing a foldLeft, but only because I know that is what the code is supposed to be doing. Otherwise, I would be completely lost and googling (probably unsuccessfully) for `/:` (besides why should I need to google just to read code of a language I've started learning 2 years ago).
The `val File(pkgs, items) = file` is a syntactical sugar shortcut for a match with one case, so it won't apply generally to examples I can provide. I argue such special cases are irregular (i.e. obscure coding constructs), because they are more things the user has to learn and remember which deviate from the main idiom of match-case.
I don't even understand the `case` without a preceding match in the (one many Scala variants for) anonymous function construct you employed. Clever but obscure. In Copute, there is usually just one construct, e.g. for the way to write an anonymous function.
Besides, that simple case I provided doesn't even get into the meat of the differences. The further we dig into examples (let's not do it in this thread please), the more obvious my point should become.
Note I am creating Copute for myself as a first motivation. Even if no one else ever uses it, I will write a lot of code with it. Thus I am very cautious about my time investment with the first iteration, and will not even attempt a debugger (can debug the Scala code output by the compiler). I intend to code using it, because I refuse to write "symbol soup" and implicit hell that is Scalaz and I need category theory to accomplish my goals of making a pure functional paradigm as modular as possible w.r.t. the Expression Problem:
--
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.
Hi Shelby,Comments are inlineOn Sat, Sep 7, 2013 at 6:05 PM, Shelby <she...@coolpage.com> wrote:
On Sunday, September 8, 2013 5:23:19 AM UTC+8, Shelby wrote:That link above apparently has his comments about Scala, also enumerates why he thinks functional programming languages such as Haskell will not likely gain mainstream adoption. Yet I am trying to address the reason he provided.Would you so kindly sum it up for me?
On Sunday, September 8, 2013 5:36:06 AM UTC+8, √iktor Klang wrote:On Sat, Sep 7, 2013 at 5:23 PM, Shelby <she...@coolpage.com> wrote:
Yeah I was expecting someone might show the clever way to use Scala's obscure coding constructs to pack it. Thank you.Could you please add some arguments as to what is "clever" and "obscure coding constructs"?(I could have packed it a lot if I wanted to sacrifice readability)On Sunday, September 8, 2013 4:14:32 AM UTC+8, √iktor Klang wrote:The Scala code isn't really neat and tidy.Compare against:def apply(file: java.lang.Object): String = {val File(pkgs, items) = file("" /: pkgs)({ case (str, PackageChained(name)) => s"${str}package ${name}\n" }) + packageOrImportOrTypedefOrObject(items, "")}That is the first time I have seen `/:` even I have been fiddling with Scala for more than 2 years on and off. I can surmise from the code that it is doing a foldLeft, but only because I know that is what the code is supposed to be doing. Otherwise, I would be completely lost and googling (probably unsuccessfully) for `/:` (besides why should I need to google just to read code of a language I've started learning 2 years ago).... and if you don't know what a foldLeft is, it's just as "obscure", which in this conversation seems to be applicable to everything one does not already know. Which doesn't really make for an interesting discussion; but for the sake of the discussion let's concede that /: is cryptic and replace it with foldLeft:def apply(file: java.lang.Object): String = {val File(pkgs, items) = filepkgs.foldLeft("")({ case (str, PackageChained(name)) => s"${str}package ${name}\n" }) + packageOrImportOrTypedefOrObject(items, "")}It adds a few characters extra, but if we think it's less obscure — then it's a gain, right?
The `val File(pkgs, items) = file` is a syntactical sugar shortcut for a match with one case, so it won't apply generally to examples I can provide. I argue such special cases are irregular (i.e. obscure coding constructs), because they are more things the user has to learn and remember which deviate from the main idiom of match-case.It's an extractor, could you elaborate what is special/obscure about it? (apply/unapply are core Scala language concepts)
I don't even understand the `case` without a preceding match in the (one many Scala variants for) anonymous function construct you employed. Clever but obscure. In Copute, there is usually just one construct, e.g. for the way to write an anonymous function.It's a PartialFunction literal, a basic Scala language construct (about as core as a function literal): http://www.scala-lang.org/api/current/index.html#scala.PartialFunction
Besides, that simple case I provided doesn't even get into the meat of the differences. The further we dig into examples (let's not do it in this thread please), the more obvious my point should become.My point was merely that your Scala code example could've been more interesting; and I offered up what I thought was an improvement.
Completely ignoring Copute for a second (which I have not commented on at all AFAICT), I'm interested in hearing more about what makes something "obscure"/"clever".
It's a PartialFunction literal, a basic Scala language construct (about as core as a function literal): http://www.scala-lang.org/api/current/index.html#scala.PartialFunction
On Sunday, September 8, 2013 6:24:19 AM UTC+8, √iktor Klang wrote:Hi Shelby,Comments are inlineOn Sat, Sep 7, 2013 at 6:05 PM, Shelby <she...@coolpage.com> wrote:
On Sunday, September 8, 2013 5:23:19 AM UTC+8, Shelby wrote:That link above apparently has his comments about Scala, also enumerates why he thinks functional programming languages such as Haskell will not likely gain mainstream adoption. Yet I am trying to address the reason he provided.Would you so kindly sum it up for me?Eric S Raymond said on April 18, 2012," I like Python because of all the languages I have ever used, it is the one that maximizes ease of long term maintainability. That is, the ease with which you can read your code six months later. The longer I program, the more convinced I am that that is THE most important metric of a language, bar none…"
" I don’t dislike Java but I think it is a little over-verbose, it’s become kind of top heavy. So it’s not my first choice, but if I had to write something in Java I wouldn’t go ‘ICK’" (he also mentioned he was one of the reviewers of the original Java language spec because "one of this friends was one of the principle designers")
"C++ has the exact opposite problem to the virtue I had called out in Python. Long-term maintainability of C++ code, TERRIBLE."
" I think the JVM has some deficiencies near word length and there are some serious problems with the numerical tower…It needs some work to be a really robust platform, it’s good but not as good as it needs to be."
"It’s [Scala] on my list of languages to learn. I have a friend whose judgment I trust who says it is a very good design, and that’s enough reason for me to go look at it."
On Sunday, September 8, 2013 5:36:06 AM UTC+8, √iktor Klang wrote:On Sat, Sep 7, 2013 at 5:23 PM, Shelby <she...@coolpage.com> wrote:
Yeah I was expecting someone might show the clever way to use Scala's obscure coding constructs to pack it. Thank you.Could you please add some arguments as to what is "clever" and "obscure coding constructs"?(I could have packed it a lot if I wanted to sacrifice readability)On Sunday, September 8, 2013 4:14:32 AM UTC+8, √iktor Klang wrote:The Scala code isn't really neat and tidy.Compare against:def apply(file: java.lang.Object): String = {val File(pkgs, items) = file("" /: pkgs)({ case (str, PackageChained(name)) => s"${str}package ${name}\n" }) + packageOrImportOrTypedefOrObject(items, "")}That is the first time I have seen `/:` even I have been fiddling with Scala for more than 2 years on and off. I can surmise from the code that it is doing a foldLeft, but only because I know that is what the code is supposed to be doing. Otherwise, I would be completely lost and googling (probably unsuccessfully) for `/:` (besides why should I need to google just to read code of a language I've started learning 2 years ago).... and if you don't know what a foldLeft is, it's just as "obscure", which in this conversation seems to be applicable to everything one does not already know. Which doesn't really make for an interesting discussion; but for the sake of the discussion let's concede that /: is cryptic and replace it with foldLeft:def apply(file: java.lang.Object): String = {val File(pkgs, items) = filepkgs.foldLeft("")({ case (str, PackageChained(name)) => s"${str}package ${name}\n" }) + packageOrImportOrTypedefOrObject(items, "")}It adds a few characters extra, but if we think it's less obscure — then it's a gain, right?I agree foldLeft is cryptic for the mainstream.
I prefer the FROM-DO-IN construct I've devised (sort of borrowed from Python). The user doesn't need to know what a fold is. They just know they want to iterate the thing(s) that follows IN.
The `val File(pkgs, items) = file` is a syntactical sugar shortcut for a match with one case, so it won't apply generally to examples I can provide. I argue such special cases are irregular (i.e. obscure coding constructs), because they are more things the user has to learn and remember which deviate from the main idiom of match-case.It's an extractor, could you elaborate what is special/obscure about it? (apply/unapply are core Scala language concepts)Yes I know that, but the user who just wants match-case isn't required to know about extractors, unless he/she wants to create customized extractors. You have about 3 levels of abstraction for the user to grasp, whereas they just want to remember one thing.
When we target the immutability of pure functional programming, we can toss all the types of `class` (and `trait`) which are not ADTs. This simplifies the issue about construction and extraction, and will come automatically as it does for `case class` in Scala, but also for `interface` in Copute.
I am unifying and simplifying concepts, where it applies to the sweet spot I have identified. I think it will be hard to explain fully in this format. Will get to that later on the website if I complete the compiler.
I don't even understand the `case` without a preceding match in the (one many Scala variants for) anonymous function construct you employed. Clever but obscure. In Copute, there is usually just one construct, e.g. for the way to write an anonymous function.It's a PartialFunction literal, a basic Scala language construct (about as core as a function literal): http://www.scala-lang.org/api/current/index.html#scala.PartialFunctionNot core for me. I avoid these confusing constructs, because they violate the "THE most important metric of a language, bar none" which is being able to read my code when I come back 6 months later. I've come across and learned something like that once, and chose to forget it.
I've read and agree that the measure of a great mainstream language is the ability to keep the whole thing in your head (forever). I am sure I have the IQ to learn and make such constructs permanently in my memory, but I purposely choose not to, because I am not writing code only for myself to see. And I want newcomers to my language to be able to read my code within a day (preferably an hour) of studying the language summary.
Besides, that simple case I provided doesn't even get into the meat of the differences. The further we dig into examples (let's not do it in this thread please), the more obvious my point should become.My point was merely that your Scala code example could've been more interesting; and I offered up what I thought was an improvement.I want the language to be less interesting. ;) Yet just as expressive and Expression Problem extensible for the 80/90% of cases (Pareto principle).
Completely ignoring Copute for a second (which I have not commented on at all AFAICT), I'm interested in hearing more about what makes something "obscure"/"clever".In my opinion, the number of concepts one has to know in order to grasp the code. For this example, one way to write an anonymous function (actually two, the (param) => or the _ for params) and one construct for match-case and one construct for iterating. And avoiding symbols like the plague, instead using short informational english keywords.
Any way, it is an experiment. I hope Typesafe appreciates that people are interested in experimenting on top of Scala. That exhibits Scala is achieving its goal of being a research into multi-paradigm. I know you are taking it commercial now, and I hope my experiment helps that cause.
I've seen you around, but didn't know you held that position. Cheers,Shelby
--
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.
On Sun, Sep 8, 2013 at 12:24 AM, √iktor Ҡlang <viktor...@gmail.com> wrote:
It's a PartialFunction literal, a basic Scala language construct (about as core as a function literal): http://www.scala-lang.org/api/current/index.html#scala.PartialFunctionActually, it is a pattern matching anonymous function. If the expected type is PartialFunction, it compiles to one of those; otherwise if the expected type is FunctionN, that's what you get.The difference isn't really that pertinent, but it does pay to be precise.
scala> { case x => x }: Any<console>:8: error: missing parameter type for expanded functionThe argument types of an anonymous function must be fully known. (SLS 8.5)Expected type was: Any{ case x => x }: Any^scala> { case x => x }: (Int => Int)res7: Int => Int = <function1>scala> classOf[PartialFunction[_, _]].isInstance(res7)res8: Boolean = falsescala> { case x => x }: PartialFunction[Int, Int]res9: PartialFunction[Int,Int] = <function1>scala> classOf[PartialFunction[_, _]].isInstance(res9)res10: Boolean = true-jason
On Sat, Sep 7, 2013 at 7:12 PM, Jason Zaugg <jza...@gmail.com> wrote:
On Sun, Sep 8, 2013 at 12:24 AM, √iktor Ҡlang <viktor...@gmail.com> wrote:
It's a PartialFunction literal, a basic Scala language construct (about as core as a function literal): http://www.scala-lang.org/api/current/index.html#scala.PartialFunctionActually, it is a pattern matching anonymous function. If the expected type is PartialFunction, it compiles to one of those; otherwise if the expected type is FunctionN, that's what you get.The difference isn't really that pertinent, but it does pay to be precise.Interesting. But since that is only observable with introspection (isInstanceOf / asInstanceOf) then it is more of an optimization? (Let's assume that PartialFunction was no costlier to generate/execute than Function1)
On Sun, Sep 8, 2013 at 1:29 AM, √iktor Ҡlang <viktor...@gmail.com> wrote:
On Sat, Sep 7, 2013 at 7:12 PM, Jason Zaugg <jza...@gmail.com> wrote:
On Sun, Sep 8, 2013 at 12:24 AM, √iktor Ҡlang <viktor...@gmail.com> wrote:
It's a PartialFunction literal, a basic Scala language construct (about as core as a function literal): http://www.scala-lang.org/api/current/index.html#scala.PartialFunctionActually, it is a pattern matching anonymous function. If the expected type is PartialFunction, it compiles to one of those; otherwise if the expected type is FunctionN, that's what you get.The difference isn't really that pertinent, but it does pay to be precise.Interesting. But since that is only observable with introspection (isInstanceOf / asInstanceOf) then it is more of an optimization? (Let's assume that PartialFunction was no costlier to generate/execute than Function1)For one thing, if it *only* ever created PartialFunction, you wouldn't be able to use if for Function2 and above.
scala> { case (true, false) => "a"; case _ => "b" } : ((Boolean, Boolean) => String)
res1: (Boolean, Boolean) => String = <function2>scala> (res1(true, false), res1(true, true))res3: (String, String) = (a,b)There is an optimization, too: one doesn't need to generate the `isDefinedAt` method for FunctionN.
On Sat, Sep 7, 2013 at 6:58 PM, Shelby <she...@coolpage.com> wrote:
On Sunday, September 8, 2013 6:24:19 AM UTC+8, √iktor Klang wrote:
On Sat, Sep 7, 2013 at 6:05 PM, Shelby <she...@coolpage.com> wrote:
On Sunday, September 8, 2013 5:23:19 AM UTC+8, Shelby wrote:That link above apparently has his comments about Scala, also enumerates why he thinks functional programming languages such as Haskell will not likely gain mainstream adoption. Yet I am trying to address the reason he provided.Would you so kindly sum it up for me?Eric S Raymond said on April 18, 2012," I like Python because of all the languages I have ever used, it is the one that maximizes ease of long term maintainability. That is, the ease with which you can read your code six months later. The longer I program, the more convinced I am that that is THE most important metric of a language, bar none…"Absolutely, and this one is also highly individual IMO; writing clear code that doesn't do more than it should, paired with a nice set of feature tests (to make sure that the code enables what should be enabled) is key to this. (I have seen unreadable/unmaintainable/horrific code in all programming languages that I've used).Also, expressivity is a key for this one, because if you can be expressive, you'll have to try to bend an inflexible environment to your will, therefor incurring a higher cost of maintenance. (more code, weird code, etc)
" I don’t dislike Java but I think it is a little over-verbose, it’s become kind of top heavy. So it’s not my first choice, but if I had to write something in Java I wouldn’t go ‘ICK’" (he also mentioned he was one of the reviewers of the original Java language spec because "one of this friends was one of the principle designers")It's more of an opinion than an argument, don't you agree?
"C++ has the exact opposite problem to the virtue I had called out in Python. Long-term maintainability of C++ code, TERRIBLE."I'm not saying that I disagree with this, but doesn't that highly depend on what language features and libraries one uses? (plus code style, testing etc?)
" I think the JVM has some deficiencies near word length and there are some serious problems with the numerical tower…It needs some work to be a really robust platform, it’s good but not as good as it needs to be."This isn't really language-related, but a platform related argument, so lets just skip that one.
"It’s [Scala] on my list of languages to learn. I have a friend whose judgment I trust who says it is a very good design, and that’s enough reason for me to go look at it."Would be cool to hear if he has had time to take a look at it and what his takeaway is.
On Sunday, September 8, 2013 5:36:06 AM UTC+8, √iktor Klang wrote:On Sat, Sep 7, 2013 at 5:23 PM, Shelby <she...@coolpage.com> wrote:
Yeah I was expecting someone might show the clever way to use Scala's obscure coding constructs to pack it. Thank you.Could you please add some arguments as to what is "clever" and "obscure coding constructs"?(I could have packed it a lot if I wanted to sacrifice readability)On Sunday, September 8, 2013 4:14:32 AM UTC+8, √iktor Klang wrote:The Scala code isn't really neat and tidy.Compare against:def apply(file: java.lang.Object): String = {val File(pkgs, items) = file("" /: pkgs)({ case (str, PackageChained(name)) => s"${str}package ${name}\n" }) + packageOrImportOrTypedefOrObject(items, "")}That is the first time I have seen `/:` even I have been fiddling with Scala for more than 2 years on and off. I can surmise from the code that it is doing a foldLeft, but only because I know that is what the code is supposed to be doing. Otherwise, I would be completely lost and googling (probably unsuccessfully) for `/:` (besides why should I need to google just to read code of a language I've started learning 2 years ago).... and if you don't know what a foldLeft is, it's just as "obscure", which in this conversation seems to be applicable to everything one does not already know. Which doesn't really make for an interesting discussion; but for the sake of the discussion let's concede that /: is cryptic and replace it with foldLeft:def apply(file: java.lang.Object): String = {val File(pkgs, items) = filepkgs.foldLeft("")({ case (str, PackageChained(name)) => s"${str}package ${name}\n" }) + packageOrImportOrTypedefOrObject(items, "")}It adds a few characters extra, but if we think it's less obscure — then it's a gain, right?I agree foldLeft is cryptic for the mainstream.But isn't it just as cryptic as "synchronized" if one doesn't know what it does? I think we'll have to assume that the person delving into new programming languages has some motivation to learn new things. And "folds" is a very useful concept to learn, don't you agree?
I prefer the FROM-DO-IN construct I've devised (sort of borrowed from Python). The user doesn't need to know what a fold is. They just know they want to iterate the thing(s) that follows IN.Yes, but they have to know what iteration means. Just to clarify my point, learning about folds is quite universal and can be of great use no matter what language you use. (recognizing the "shape" of a fold in a problem etc) Learning Scala and functional programming in general has really improved the way I program C, Javascript and other languages.
The `val File(pkgs, items) = file` is a syntactical sugar shortcut for a match with one case, so it won't apply generally to examples I can provide. I argue such special cases are irregular (i.e. obscure coding constructs), because they are more things the user has to learn and remember which deviate from the main idiom of match-case.It's an extractor, could you elaborate what is special/obscure about it? (apply/unapply are core Scala language concepts)Yes I know that, but the user who just wants match-case isn't required to know about extractors, unless he/she wants to create customized extractors. You have about 3 levels of abstraction for the user to grasp, whereas they just want to remember one thing.They just need to remember one thing, the Scala syntax :)Jokes aside, do you have a reference to that statement ("Programmers just want to remember one thing")?
When we target the immutability of pure functional programming, we can toss all the types of `class` (and `trait`) which are not ADTs. This simplifies the issue about construction and extraction, and will come automatically as it does for `case class` in Scala, but also for `interface` in Copute.I am unifying and simplifying concepts, where it applies to the sweet spot I have identified. I think it will be hard to explain fully in this format. Will get to that later on the website if I complete the compiler.I'm all for unification and simplification, and I find this discussion interesting, so thanks for that!
I don't even understand the `case` without a preceding match in the (one many Scala variants for) anonymous function construct you employed. Clever but obscure. In Copute, there is usually just one construct, e.g. for the way to write an anonymous function.It's a PartialFunction literal, a basic Scala language construct (about as core as a function literal): http://www.scala-lang.org/api/current/index.html#scala.PartialFunctionNot core for me. I avoid these confusing constructs, because they violate the "THE most important metric of a language, bar none" which is being able to read my code when I come back 6 months later. I've come across and learned something like that once, and chose to forget it.It is confusing because you choose to forget what it means? Given that you remember folds (which should be applicable in any PL that you use, no matter what) then wouldn't you say it's quite obvious what happens in the code with the PartialFunction?
I've read and agree that the measure of a great mainstream language is the ability to keep the whole thing in your head (forever). I am sure I have the IQ to learn and make such constructs permanently in my memory, but I purposely choose not to, because I am not writing code only for myself to see. And I want newcomers to my language to be able to read my code within a day (preferably an hour) of studying the language summary.Can you name one such language? (keep in mind that there are very dark corners in the Javascript spec, the Java spec, the C spec, the C++ spec etc)
Besides, that simple case I provided doesn't even get into the meat of the differences. The further we dig into examples (let's not do it in this thread please), the more obvious my point should become.My point was merely that your Scala code example could've been more interesting; and I offered up what I thought was an improvement.I want the language to be less interesting. ;) Yet just as expressive and Expression Problem extensible for the 80/90% of cases (Pareto principle).I totally understand that, and I hope you get to the place you want to go with that :)
Completely ignoring Copute for a second (which I have not commented on at all AFAICT), I'm interested in hearing more about what makes something "obscure"/"clever".In my opinion, the number of concepts one has to know in order to grasp the code. For this example, one way to write an anonymous function (actually two, the (param) => or the _ for params) and one construct for match-case and one construct for iterating. And avoiding symbols like the plague, instead using short informational english keywords.So no + - / * etc for numerical operations?
Any way, it is an experiment. I hope Typesafe appreciates that people are interested in experimenting on top of Scala. That exhibits Scala is achieving its goal of being a research into multi-paradigm. I know you are taking it commercial now, and I hope my experiment helps that cause.I sincerely hope I didn't come across as criticizing your project, to my knowledge I haven't said much about it at all :). (As I said, I was more interested in improving the Scala example you gave.)Personally I am all for research, experimentation and the broaden of one's horizons, so I wish you the best of times hacking on your project.
Hi Victor,On Sunday, September 8, 2013 7:22:41 AM UTC+8, √iktor Klang wrote:On Sat, Sep 7, 2013 at 6:58 PM, Shelby <she...@coolpage.com> wrote:
On Sunday, September 8, 2013 6:24:19 AM UTC+8, √iktor Klang wrote:On Sat, Sep 7, 2013 at 6:05 PM, Shelby <she...@coolpage.com> wrote:
On Sunday, September 8, 2013 5:23:19 AM UTC+8, Shelby wrote:That link above apparently has his comments about Scala, also enumerates why he thinks functional programming languages such as Haskell will not likely gain mainstream adoption. Yet I am trying to address the reason he provided.Would you so kindly sum it up for me?Eric S Raymond said on April 18, 2012," I like Python because of all the languages I have ever used, it is the one that maximizes ease of long term maintainability. That is, the ease with which you can read your code six months later. The longer I program, the more convinced I am that that is THE most important metric of a language, bar none…"Absolutely, and this one is also highly individual IMO; writing clear code that doesn't do more than it should, paired with a nice set of feature tests (to make sure that the code enables what should be enabled) is key to this. (I have seen unreadable/unmaintainable/horrific code in all programming languages that I've used).Also, expressivity is a key for this one, because if you can be expressive, you'll have to try to bend an inflexible environment to your will, therefor incurring a higher cost of maintenance. (more code, weird code, etc)
Agreed on your points. There is a balance between levels (degrees-of-freedom) of abstraction (thus expressiveness) and regularity. Apparently man-years of experience went into the balance in Python. I surmise Eric is pointing the regularity of Python more than anything else, which I will elaborate on below. Eric has also said that Guido wanted to remove the functional programming parts of Python and Eric said "over his dead body" or something like that." I don’t dislike Java but I think it is a little over-verbose, it’s become kind of top heavy. So it’s not my first choice, but if I had to write something in Java I wouldn’t go ‘ICK’" (he also mentioned he was one of the reviewers of the original Java language spec because "one of this friends was one of the principle designers")It's more of an opinion than an argument, don't you agree?I doubt you'd find any Scala-head who thinks Scala is not less verbose than Java. Write an anonymous function in Java for example.
"C++ has the exact opposite problem to the virtue I had called out in Python. Long-term maintainability of C++ code, TERRIBLE."I'm not saying that I disagree with this, but doesn't that highly depend on what language features and libraries one uses? (plus code style, testing etc?)Higher-kinded types in C++ (templates) are convoluted:I guess you can use auto_ptr to achieve some of the managed code safety and brevity.But the real issue is you can't express modularity as orthogonally in C++ as you can in Scala (and Python) with mixins, higher-kinds for typeclasses for functors, etc.. Thus maintainability is lost because refactoring is required where high-level abstractions would have afforded extensibility instead. This is the one the key reasons I am doing Copute (so I get benefits of Scalaz without the obtuseness):" I think the JVM has some deficiencies near word length and there are some serious problems with the numerical tower…It needs some work to be a really robust platform, it’s good but not as good as it needs to be."This isn't really language-related, but a platform related argument, so lets just skip that one.Okay but I want a real unsigned type! I've seen Odersky's library for UInt, but I don't think that it quite same.
I've been told we won't pull Python developers (mainstream) for as long as we require they learn folds (elaborates on upthread point on regularity):(just keep reading from the comment forward as far as you want to go into the discussion I had)I prefer the FROM-DO-IN construct I've devised (sort of borrowed from Python). The user doesn't need to know what a fold is. They just know they want to iterate the thing(s) that follows IN.Yes, but they have to know what iteration means. Just to clarify my point, learning about folds is quite universal and can be of great use no matter what language you use. (recognizing the "shape" of a fold in a problem etc) Learning Scala and functional programming in general has really improved the way I program C, Javascript and other languages.I agree functional programmer is a more general abstraction, but I learned a lot about existing programmers in the aforementioned linked discussion.I think hooking them first with something that appears to be imperative, yet underneath is really declarative, is the way to coax them over the hump.Scala has tried to do that too to some extent, e.g. the for-comprehension. I am attempting to unify more.The `val File(pkgs, items) = file` is a syntactical sugar shortcut for a match with one case, so it won't apply generally to examples I can provide. I argue such special cases are irregular (i.e. obscure coding constructs), because they are more things the user has to learn and remember which deviate from the main idiom of match-case.It's an extractor, could you elaborate what is special/obscure about it? (apply/unapply are core Scala language concepts)Yes I know that, but the user who just wants match-case isn't required to know about extractors, unless he/she wants to create customized extractors. You have about 3 levels of abstraction for the user to grasp, whereas they just want to remember one thing.They just need to remember one thing, the Scala syntax :)Jokes aside, do you have a reference to that statement ("Programmers just want to remember one thing")?I forgot. I've read so much on Lambda-the-ultimate. Perhaps is was Guy Steele.
When we target the immutability of pure functional programming, we can toss all the types of `class` (and `trait`) which are not ADTs. This simplifies the issue about construction and extraction, and will come automatically as it does for `case class` in Scala, but also for `interface` in Copute.I am unifying and simplifying concepts, where it applies to the sweet spot I have identified. I think it will be hard to explain fully in this format. Will get to that later on the website if I complete the compiler.I'm all for unification and simplification, and I find this discussion interesting, so thanks for that!I am trying to coax them over to Scala-world. They can go deeper into Scala syntax by studying what is output from a simpler syntax. Also I want to pick off some things I can't express elegantly in Scala w.r.t. to category theory.
I don't even understand the `case` without a preceding match in the (one many Scala variants for) anonymous function construct you employed. Clever but obscure. In Copute, there is usually just one construct, e.g. for the way to write an anonymous function.It's a PartialFunction literal, a basic Scala language construct (about as core as a function literal): http://www.scala-lang.org/api/current/index.html#scala.PartialFunctionNot core for me. I avoid these confusing constructs, because they violate the "THE most important metric of a language, bar none" which is being able to read my code when I come back 6 months later. I've come across and learned something like that once, and chose to forget it.It is confusing because you choose to forget what it means? Given that you remember folds (which should be applicable in any PL that you use, no matter what) then wouldn't you say it's quite obvious what happens in the code with the PartialFunction?Honestly I didn't (yet) try to study how the PartialFunction is working. It deviates from the simple concept of "I pass in a function" to I guess something like "I pass in the remaining partial application of a function".
I'd probably rather see the partial application done explicitly using closures. My current belief is that abstractions which hide what is really going on, really confuse people who can't reason down the levels of abstractions to get a mental picture of what is invisible to their eyes. Too many of those hiding abstractions chained into an expression can make it insurmountable for many people. Not for me, yet I choose not to go there unless there is a very compelling reason to do so. Hope I didn't put my foot in my mouth, which happens when I comment on some syntax I haven't taken the time to understand. Perhaps it is absolutely necessary I learn it.
This is also why I don't allow using method names as binary, infix operators as Scala does. It is cute the way expressions will read like english statements, yet I think it is confusing for users to visualize the associativity.
I've read and agree that the measure of a great mainstream language is the ability to keep the whole thing in your head (forever). I am sure I have the IQ to learn and make such constructs permanently in my memory, but I purposely choose not to, because I am not writing code only for myself to see. And I want newcomers to my language to be able to read my code within a day (preferably an hour) of studying the language summary.Can you name one such language? (keep in mind that there are very dark corners in the Javascript spec, the Java spec, the C spec, the C++ spec etc)I suppose K&R C. Some dark corners but for the 80% sweet spot, they mostly don't come up.
Ditto HTML.
Besides, that simple case I provided doesn't even get into the meat of the differences. The further we dig into examples (let's not do it in this thread please), the more obvious my point should become.My point was merely that your Scala code example could've been more interesting; and I offered up what I thought was an improvement.I want the language to be less interesting. ;) Yet just as expressive and Expression Problem extensible for the 80/90% of cases (Pareto principle).I totally understand that, and I hope you get to the place you want to go with that :)Thanks very much for the sentiments.I am not aiming to make money on Copute, rather to make money on what I can code with it. I have many other projects I would like to be working on.Any one that wants to "steal" ideas is more than welcome.Completely ignoring Copute for a second (which I have not commented on at all AFAICT), I'm interested in hearing more about what makes something "obscure"/"clever".In my opinion, the number of concepts one has to know in order to grasp the code. For this example, one way to write an anonymous function (actually two, the (param) => or the _ for params) and one construct for match-case and one construct for iterating. And avoiding symbols like the plague, instead using short informational english keywords.So no + - / * etc for numerical operations?Except of course the well known operators.
I think Java had this one correct. I did consider allowing the well known operators to be overloaded and enforcing their behavior. For the moment that is on the back burner.
Any way, it is an experiment. I hope Typesafe appreciates that people are interested in experimenting on top of Scala. That exhibits Scala is achieving its goal of being a research into multi-paradigm. I know you are taking it commercial now, and I hope my experiment helps that cause.I sincerely hope I didn't come across as criticizing your project, to my knowledge I haven't said much about it at all :). (As I said, I was more interested in improving the Scala example you gave.)Personally I am all for research, experimentation and the broaden of one's horizons, so I wish you the best of times hacking on your project.Oh I never thought you were. I was just hoping to hear that Typesafe likes to see this sort of experimentation. So I am happy to read.Cheers,Shelby
--
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 dislike Java but I think it is a little over-verbose, it’s become kind of top heavy. So it’s not my first choice, but if I had to write something in Java I wouldn’t go ‘ICK’" (he also mentioned he was one of the reviewers of the original Java language spec because "one of this friends was one of the principle designers")It's more of an opinion than an argument, don't you agree?I doubt you'd find any Scala-head who thinks Scala is not less verbose than Java. Write an anonymous function in Java for example.Well, Intellij IDEA does "fold" anon inner classes into a more readable format. (Java devs often use code generation from within their IDE to do these things), but I agree with your point :)
" I think the JVM has some deficiencies near word length and there are some serious problems with the numerical tower…It needs some work to be a really robust platform, it’s good but not as good as it needs to be."This isn't really language-related, but a platform related argument, so lets just skip that one.Okay but I want a real unsigned type! I've seen Odersky's library for UInt, but I don't think that it quite same.I guess a more general idea is to be able to constrain the size/range of numeric types and have the good ol' compiler help you out.
I've been told we won't pull Python developers (mainstream) for as long as we require they learn folds (elaborates on upthread point on regularity):(just keep reading from the comment forward as far as you want to go into the discussion I had)I prefer the FROM-DO-IN construct I've devised (sort of borrowed from Python). The user doesn't need to know what a fold is. They just know they want to iterate the thing(s) that follows IN.Yes, but they have to know what iteration means. Just to clarify my point, learning about folds is quite universal and can be of great use no matter what language you use. (recognizing the "shape" of a fold in a problem etc) Learning Scala and functional programming in general has really improved the way I program C, Javascript and other languages.I agree functional programmer is a more general abstraction, but I learned a lot about existing programmers in the aforementioned linked discussion.
The `val File(pkgs, items) = file` is a syntactical sugar shortcut for a match with one case, so it won't apply generally to examples I can provide. I argue such special cases are irregular (i.e. obscure coding constructs), because they are more things the user has to learn and remember which deviate from the main idiom of match-case.It's an extractor, could you elaborate what is special/obscure about it? (apply/unapply are core Scala language concepts)Yes I know that, but the user who just wants match-case isn't required to know about extractors, unless he/she wants to create customized extractors. You have about 3 levels of abstraction for the user to grasp, whereas they just want to remember one thing.They just need to remember one thing, the Scala syntax :)Jokes aside, do you have a reference to that statement ("Programmers just want to remember one thing")?I forgot. I've read so much on Lambda-the-ultimate. Perhaps is was Guy Steele.I would definitely have preferred some kind of study :)
When we target the immutability of pure functional programming, we can toss all the types of `class` (and `trait`) which are not ADTs. This simplifies the issue about construction and extraction, and will come automatically as it does for `case class` in Scala, but also for `interface` in Copute.I am unifying and simplifying concepts, where it applies to the sweet spot I have identified. I think it will be hard to explain fully in this format. Will get to that later on the website if I complete the compiler.I'm all for unification and simplification, and I find this discussion interesting, so thanks for that!I am trying to coax them over to Scala-world. They can go deeper into Scala syntax by studying what is output from a simpler syntax. Also I want to pick off some things I can't express elegantly in Scala w.r.t. to category theory.I'm not sure that studying the generated output will be all that beneficial for understanding.
I don't even understand the `case` without a preceding match in the (one many Scala variants for) anonymous function construct you employed. Clever but obscure. In Copute, there is usually just one construct, e.g. for the way to write an anonymous function.It's a PartialFunction literal, a basic Scala language construct (about as core as a function literal): http://www.scala-lang.org/api/current/index.html#scala.PartialFunctionNot core for me. I avoid these confusing constructs, because they violate the "THE most important metric of a language, bar none" which is being able to read my code when I come back 6 months later. I've come across and learned something like that once, and chose to forget it.It is confusing because you choose to forget what it means? Given that you remember folds (which should be applicable in any PL that you use, no matter what) then wouldn't you say it's quite obvious what happens in the code with the PartialFunction?Honestly I didn't (yet) try to study how the PartialFunction is working. It deviates from the simple concept of "I pass in a function" to I guess something like "I pass in the remaining partial application of a function".Partial application is something completely different; a Partial Function is a function which is not defined for the full domain of its possible inputs.
I'd probably rather see the partial application done explicitly using closures. My current belief is that abstractions which hide what is really going on, really confuse people who can't reason down the levels of abstractions to get a mental picture of what is invisible to their eyes. Too many of those hiding abstractions chained into an expression can make it insurmountable for many people. Not for me, yet I choose not to go there unless there is a very compelling reason to do so. Hope I didn't put my foot in my mouth, which happens when I comment on some syntax I haven't taken the time to understand. Perhaps it is absolutely necessary I learn it.Clearly one cannot expect to understand something without having attempted to learn, right?
This is also why I don't allow using method names as binary, infix operators as Scala does. It is cute the way expressions will read like english statements, yet I think it is confusing for users to visualize the associativity.Is this based on hunch or study?
I've read and agree that the measure of a great mainstream language is the ability to keep the whole thing in your head (forever). I am sure I have the IQ to learn and make such constructs permanently in my memory, but I purposely choose not to, because I am not writing code only for myself to see. And I want newcomers to my language to be able to read my code within a day (preferably an hour) of studying the language summary.Can you name one such language? (keep in mind that there are very dark corners in the Javascript spec, the Java spec, the C spec, the C++ spec etc)I suppose K&R C. Some dark corners but for the 80% sweet spot, they mostly don't come up.Considering how many people who seem to have huge issues understanding pointers and pointer arithmetics I'd tend to disagree with that.
Ditto HTML.Test: Which HTML elements do not have an end tag? Do you remember?
Completely ignoring Copute for a second (which I have not commented on at all AFAICT), I'm interested in hearing more about what makes something "obscure"/"clever".In my opinion, the number of concepts one has to know in order to grasp the code. For this example, one way to write an anonymous function (actually two, the (param) => or the _ for params) and one construct for match-case and one construct for iterating. And avoiding symbols like the plague, instead using short informational english keywords.So no + - / * etc for numerical operations?Except of course the well known operators.
I think Java had this one correct. I did consider allowing the well known operators to be overloaded and enforcing their behavior. For the moment that is on the back burner.
3User-defined with these suggested meanings. Must output the same type as one of the operands, to reduce confusion as to what overloaded operators do.
4User-defined with suggested relational meaning. Must output the same type as the equality operator.
one step. Haskell was difficult for me, because it was so different than the programming I had done since I was 17 in 1983. Eric Raymond was able to learn Haskell faster partially because it comes from LISP.
I think Java had this one correct. I did consider allowing the well known operators to be overloaded and enforcing their behavior. For the moment that is on the back burner.I would disagree with that, Java operators aren't really "intuitive".I think we'll need to agree that understanding the semantics and name of a symbol requires learning.Learning is good. Ideally things you learn should be something that allows you to reuse that knowledge.
my experience learning numbers languages over 30 years
There is one potential expectation violation though, consider this:def foo(f: Int => String): Unit = f match {case p: PartialFunction[Int, String] => p.applyOrElse(magicNumber, whathaveyou)case fun => fun(magicNumber)}Now, passing in a known-to-be-PartialFunction would have different semantics than calling the method with a partial function literal.("As described in section 15.7, a partial function literal is expressed as a series of match alternatives or "cases". It looks like a match expression without the match keyword." - p587 in Programming in Scala)
The encoding of the PFL is more of an optimization detail rather than a language feature, or is it specced?
Instead of us us arguing this out best is to let typesafe figure it out. What we can do is provide some input.They can do a survey of features which different businesses and industries want and then perhaps add this. Their marketing team most likely to this on and off
Actually this is much more viable and promising technology than having a SVM.
If the main reason to pool scarce resources away from current Scala priorities, is to enable Scala programming the in browser for mobile, I say don't bother. The small screens on mobile are conducive to the browser and most prefer to run a dedicated app which is tuned to the device. Your app can access the internet and even embed rendered HTML.
If ever there is a compelling reason to run Java in a mobile browser, it will get done.Scala needs to stay focused on perfecting and refining the language and libraries.
This also makes it difficult for us to prioritize activities around influencing the JCP: if we can only take advantage of the results in 4-8 years (time to spec, integrate and stabilize a feature in a new JDK and then to wait for enough of the market to adopt that JDK.) The best sort of new JDK features are of course new optimizations that just kick in for users of the new platform without changes to scalac (tail call elimination, better inlining of closure-like patterns in code, etc), which might land closer to the 4 year mark. These are the areas that we get the most bang for our buck in advocacy.
That is the first time I have seen `/:` even I have been fiddling with Scala for more than 2 years on and off.
On Sat, Sep 7, 2013 at 6:05 PM, Shelby <she...@coolpage.com> wrote:That is the first time I have seen `/:` even I have been fiddling with Scala for more than 2 years on and off.Um -- seriously, not a strong argument. I am far from a deep Scala expert (been working really seriously in it for about a year), and I use /: literally all the time -- it's one of the most useful tools in the Scala toolbelt, the one you usually reach for when one of the built-in transformations doesn't suffice. Not only is it described in every Scala book I've read, the rationale for *why* it is called "/:" shows up in pretty much all of them.
Completely ignoring Copute for a second (which I have not commented on at all AFAICT), I'm interested in hearing more about what makes something "obscure"/"clever".In my opinion, the number of concepts one has to know in order to grasp the code. For this example, one way to write an anonymous function (actually two, the (param) => or the _ for params) and one construct for match-case and one construct for iterating. And avoiding symbols like the plague, instead using short informational english keywords.So no + - / * etc for numerical operations?Except of course the well known operators.Is % well-known? How about ^, ||, &&, ~, ;, :, etc?
On Sat, Sep 7, 2013 at 11:24 PM, √iktor Ҡlang <viktor...@gmail.com> wrote:
> Would you so kindly sum it up for me?
"Your ideas are intriguing to me and I wish to subscribe to your newsletter" ;-)
+++++ +++++ initialize counter (cell #0) to 10 [ use loop to set the next four cells to 70/100/30/10 > +++++ ++ add 7 to cell #1 > +++++ +++++ add 10 to cell #2 > +++ add 3 to cell #3 > + add 1 to cell #4 <<<< - decrement counter (cell #0) ] > ++ . print 'H' > + . print 'e' +++++ ++ . print 'l' . print 'l' +++ . print 'o' > ++ . print ' ' << +++++ +++++ +++++ . print 'W' > . print 'o' +++ . print 'r' ----- - . print 'l' ----- --- . print 'd' > + . print '!' > . print '\n'
On Sunday, September 8, 2013 9:05:11 AM UTC+8, √iktor Klang wrote:Completely ignoring Copute for a second (which I have not commented on at all AFAICT), I'm interested in hearing more about what makes something "obscure"/"clever".In my opinion, the number of concepts one has to know in order to grasp the code. For this example, one way to write an anonymous function (actually two, the (param) => or the _ for params) and one construct for match-case and one construct for iterating. And avoiding symbols like the plague, instead using short informational english keywords.So no + - / * etc for numerical operations?Except of course the well known operators.Is % well-known? How about ^, ||, &&, ~, ;, :, etc?My current rule is don't add any more EMOTICON operators that don't have an intuitive meaning, i.e. /: or /:\ or those lower/upper bounds I always get transposed in my mind <: and >: (Copute uses `in` and `io` with covariant as the default). I mean really the code looks comical. For example +, -, <, >, & are intuitive.
As for * and /, I would prefer × and ÷ if unicode is ubiquitous and they could always be typed easily, neither of which is the case. More dubious is ⊕ instead of ^. Thus, for now, these preferences can be automatically displayed by the IDE and/or special rendering for HTML.
Modulo % is reasonably well known to those who need to use it.
I think I would prefer the more intuitive ! instead of ~, where ! has different meanings when applied to booleans and integers. This will still give the desired result for if (!integer).
And the ? is unused and intuitive, so I will put it to good use in Copute, dealing with the Option both on types and on a syntactical sugar for unboxing Option in an if-else expression.Well ; almost disappears both in Scala and Copute thank you Lord. And : follows its grammatical meaning reasonably intuitively.
In short, no more dual character symbols, except the obvious one <=, >=, ==, !=, and single char symbol with =, e.g. +=.
--
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.
On Mon, Sep 9, 2013 at 10:13 AM, Shelby <she...@coolpage.com> wrote:
> On Monday, September 9, 2013 4:57:50 PM UTC+8, Miles Sabin wrote:
>
>> On Sat, Sep 7, 2013 at 11:24 PM, √iktor Ҡlang <viktor...@gmail.com> wrote:
>> > Would you so kindly sum it up for me?
>>
>> "Your ideas are intriguing to me and I wish to subscribe to your
>> newsletter" ;-)
>
>
> Please don't tell me I am going to get that same sh$t here. Cripes, it is
> scala-DEBATE.
Exactly ... I think you're looking for scala-troll.
> Stuff your ego dude. Sorry if I criticized your Shapeless in the other
> thread ;)
You did? I didn't notice.
Tangentially note that I have been on stackoverflow reading Scala Q&A, read the tour intro at scala-lang.org, read the Programming in Scala book by the creator of Scala, and never did I come across that. Perhaps it is buried in that 700 page book?
I once tried to read the Scala spec, and quickly abandoned that as too verbose.
I don't know if this is unique to me (or my recent illness), but seems I am getting old enough now (48.5) where my brain filters non-words (that weren't learned and embedded long ago) as noise.
In fact, my brain wants to filter anything that is not direct-to-the-point and intuitively, readily grasped.
On Mon, Sep 9, 2013 at 10:47 AM, Shelby <she...@coolpage.com> wrote:
On Sunday, September 8, 2013 9:05:11 AM UTC+8, √iktor Klang wrote:Completely ignoring Copute for a second (which I have not commented on at all AFAICT), I'm interested in hearing more about what makes something "obscure"/"clever".In my opinion, the number of concepts one has to know in order to grasp the code. For this example, one way to write an anonymous function (actually two, the (param) => or the _ for params) and one construct for match-case and one construct for iterating. And avoiding symbols like the plague, instead using short informational english keywords.So no + - / * etc for numerical operations?Except of course the well known operators.Is % well-known? How about ^, ||, &&, ~, ;, :, etc?My current rule is don't add any more EMOTICON operators that don't have an intuitive meaning, i.e. /: or /:\ or those lower/upper bounds I always get transposed in my mind <: and >: (Copute uses `in` and `io` with covariant as the default). I mean really the code looks comical. For example +, -, <, >, & are intuitive.In what way are they intuitive? I had to learn the meaning of all of those.
As for * and /, I would prefer × and ÷ if unicode is ubiquitous and they could always be typed easily, neither of which is the case. More dubious is ⊕ instead of ^. Thus, for now, these preferences can be automatically displayed by the IDE and/or special rendering for HTML.
Modulo % is reasonably well known to those who need to use it.Doesn't that depend on what you have learned previously? A new programmer that tries to use Copute won't "intuitively" know what % does. Also, is the semantics of / "intuitive"? What about integer /? What about floats and doubles, they are hardly "intuitive".
I think I would prefer the more intuitive ! instead of ~, where ! has different meanings when applied to booleans and integers. This will still give the desired result for if (!integer).Is ! intuitive? If I ask my friend who's not a programmer what "!foo" means, will he intuitively know?
And the ? is unused and intuitive, so I will put it to good use in Copute, dealing with the Option both on types and on a syntactical sugar for unboxing Option in an if-else expression.Well ; almost disappears both in Scala and Copute thank you Lord. And : follows its grammatical meaning reasonably intuitively.
In short, no more dual character symbols, except the obvious one <=, >=, ==, !=, and single char symbol with =, e.g. +=.Universal equality? Universal comparison (Comparable and friends)?
On Sun, Sep 8, 2013 at 1:34 PM, Shelby <she...@coolpage.com> wrote:Tangentially note that I have been on stackoverflow reading Scala Q&A, read the tour intro at scala-lang.org, read the Programming in Scala book by the creator of Scala, and never did I come across that. Perhaps it is buried in that 700 page book?
I don't know about "buried", but yes, that's where I first came across it. A quick Google turns it up on page 347 of the first edition -- admittedly a goodly ways in, but it's far from the densest technical manual I've read (even in the past year). And it does have the rationale behind the specific symbol right there, at the first usage of that symbol.
Frankly, I found that *remarkably* useful -- I have always had trouble keeping "foldleft" and "foldright" straight, but the symbol actually makes it much easier for me to reason about how to write my code, since the symbol is essentially a picture of what it's doing.
(Although really, the *main* place I come across it is in the API docs: it's near the top of every Collection AFAIK, so I stumbled across it very early just looking things up, and see it there pretty much every day. Since it is one of the very few symbols in the Collections library, it is *really* conspicuous to me.)
I once tried to read the Scala spec, and quickly abandoned that as too verbose.
I can certainly understand that. But Programming in Scala is relatively well-written as language books go, and Scala for the Impatient is an absolute delight. (It repeats the same explanation in Chapter 13.)
I don't know if this is unique to me (or my recent illness), but seems I am getting old enough now (48.5) where my brain filters non-words (that weren't learned and embedded long ago) as noise.My sympathies about the illness, but I'm just about precisely the same age (one month older than you, if your 48.5 is exact), and every bit as focused on making my mark.
And yes, non-words can be tricky -- but new concepts are trickier, and a symbol that inherently *explains* the new concept is totally a win in my experience.In fact, my brain wants to filter anything that is not direct-to-the-point and intuitively, readily grasped.I can entirely understand that, but I don't think it's an excuse. This stuff *is* deep, and excelling at it requires a time investment to understand it. And yes, that does mean reading the documentation -- not every detail of the spec, but at least the good overview books like the ones I mention above.
I really do get what you're saying. But I think you're just plain taking the argument to the point of reductio ad absurdam -- it's coming across as "I don't personally get that symbol immediately, so it is Bad", which is subjective to the point of useless.
And I find it poorly aimed, given that we're talking about one of the few invented symbols I have *ever* come across that actually has clear, commonly-documented and easy to remember logic behind it, instead of being the usual arbitrarily-chosen string of characters...
The Scala code isn't really neat and tidy.Compare against:def apply(file: java.lang.Object): String = {val File(pkgs, items) = file("" /: pkgs)({ case (str, PackageChained(name)) => s"${str}package ${name}\n" }) + packageOrImportOrTypedefOrObject(items, "")}
On Sat, Sep 7, 2013 at 11:22 AM, Shelby <she...@coolpage.com> wrote:Note I am already seeing the possibility of Copute being 2X more concise than Scala (and we know Scala is 2 - 3X more concise than Java. For example the following Scala code (from the Copute compiler):def apply(file: java.lang.Object): String = file match { case File(pkgs,items) => pkgs.foldLeft("")( (s,x) => s + (x match { case PackageChained(name) => "package " + name + "\n" }) ) + packageOrImportOrTypedefOrObject(items, "") }Can be code equivalently (will generate the same Scala code) in Copute as follows:apply(file): java.lang.Object String = IF file IS File(pkgs,items) DO { (FROM "" DO (_ + IF _1 IS PackageChained(name) DO "package " + name + "\n") IN pkgs) + packageOrImportOrTypedefOrObject(items, "") }
I support a more generalized language concept than the methods exists and find, which requires a generalized foldLeft and foldRight variant (which Scala's std library doesn't have yet):IN expr WHILE expr DO exprwhere the DO expr returns a tuple of the result and a boolean. For example to implement exists:IN collection WHILE false { IF _1 == thing DO (true,false) ELSE (false,true) }Of course it is still good to provide the exists and find methods to make the code clearer and more concise, while the above can be used for more generalized needs.
--
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 which one do you think a person unfamiliar with both will more readily grasp without reading to page 342 in Programming in Scala?That's a false argument though!You could just as easily find an example from differential calculus that you explain more "clearly" by avoiding Leibniz's notation, and it would truly be clearer to somebody who hadn't studied established conventions in that particular branch of mathematics. To people who DO work with calculus on a regular basis, it would just come across as verbose and cluttered, obscuring the essential complexity of the problem.The same is true here. foldLeft (and the symbolic representation thereof) are an established convention for collapsing some collection of values into a single output, just as pattern matching in a val assignment is an established pattern for deconstructing a tuple.It's often clearer to explain things by avoiding symbolic notation, but only to those people who don't frequently work with the concepts those symbols represent; so you're helping the people who least need it!
This isn't *quite* so useless as fitting your car dashboard with a braille speedometer to make it more accessible to blind drivers, but you get the idea :)
// Any are named?IF typerefs.exists( IF _ IS NamedTupleRef(Some(_),_) DO true ELSE false ) ...
--
if (typerefs.exists { case NamedTupleRef(Some(_),_) => true; case _ => false })
--
On 10 September 2013 10:19, Shelby <she...@coolpage.com> wrote:On Tuesday, September 10, 2013 5:13:10 PM UTC+8, Shelby wrote:// Any are named?IF typerefs.exists( IF _ IS NamedTupleRef(Some(_),_) DO true ELSE false ) ...Typo:IF typerefs.exists( IF _ IS NamedTupleRef(Some(?),?) DO true ELSE false ) ...--
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.
Recursion is not the way mainstream programmers visualize iteration. Take a survey C, C++, C#, PHP, Java, etc programmers. I am confident about predicting the result ;)
Understood. If you get too close to the current standard library, you begin to think it is the same as Scala. For me, Scala is the compiler and I love it! I can't heap enough gratitude on Martin and the others who built this. You guys are awesome! (including Miles Sabin who has apparently contributed) But the standard library has thorns I don't like, although there is a lot of code and ideas in it I like.
I don't know if this is unique to me (or my recent illness), but seems I am getting old enough now (48.5) where my brain filters non-words (that weren't learned and embedded long ago) as noise.My sympathies about the illness, but I'm just about precisely the same age (one month older than you, if your 48.5 is exact), and every bit as focused on making my mark.Then come help me ;) Joke.
Good luck too. Mine is auto-immunity (not cured, possibly progressive) and was complications from simultaneous dengue and acute h.pylori (now cured I hope).
Oh yeah there are going to be deep issues, yet to the extent we can eliminate unnecessary consternation, the better.
But without experimenting, we can't prove some issues one way or the other in the marketplace.
The languages that become popular were ones you grabbed and they just flowed from your priority experience, e.g. PHP. I was coding in PHP about 15 minutes after picking it up. Not too many nasty surprises and head-scratching moments.
On Tue, Sep 10, 2013 at 1:56 AM, Kevin Wright <kev.lee...@gmail.com> wrote:
The same is true here. foldLeft (and the symbolic representation thereof) are an established convention for collapsing some collection of values into a single output, just as pattern matching in a val assignment is an established pattern for deconstructing a tuple.
Folds are fairly established but I disagree that its symbolic representation is as well. Take a look at this list of fold functions in various languages and you won't find :/
anywhere. Not even on the Scala row!
I think it's disingenuous to suggest that :/
is as universally established as +
or -
(not saying you did but a few other participants in the discussion did earlier, and I've heard it many times in the past years). By definition, symbols every student who graduates from high school is familiar with will be more universally recognized than those that are taught in college (or in the case of :/
, beyond college).
Either way, I think discussing this point is somewhat moot since even early proponents of such symbols (scalaz, spray) are now moving toward offering aliases for such symbols, so the point seems to be generally conceded.
On Tue, Sep 10, 2013 at 12:47:20PM -0700, Rex Kerr wrote:Although the :/ operator does exist!
> It's /: and :\. There is no :/. The \ or / is the toppling-over domino
> that is going to consume the rest of the list (which is on the : side).
if (typerefs.exists { case NamedTupleRef(Some(_),_) => true; case _ => false })
On Tue, Sep 10, 2013 at 1:03 AM, Shelby <she...@coolpage.com> wrote:Recursion is not the way mainstream programmers visualize iteration. Take a survey C, C++, C#, PHP, Java, etc programmers. I am confident about predicting the result ;)True, but not very useful. You're indirectly arguing, "most programmers are too dumb to use the language, so the language is wrong". (Since effective use of recursion is important to using Scala effectively.) And I can't agree with that. As a team lead, I spend a *lot* of my effort educating my programmers -- I consider that a key part of my job. Yes, it's a lot of effort, but I get *vastly* better code as a result.
Thinking in recursion instead of iteration is a major part of switching from procedural to functional programming. Hell, I'd probably say it is the *most* important part (although, again, closures probably tie with it). If somebody's going to work for me today, I demand that ability -- I run startups, and I just can't afford engineers who can't keep up with the major trends in programming. If you aren't grokking at least these basics, then I'd say you're pretty much wasting your time using Scala -- you're just going to wind up writing Java with a different syntax.
And back to the point: once you *do* understand recursion, I think the symbolic explanation is quite natural. (And really, I'm not likely to try to have somebody use foldLeft, by whichever name, until they grok recursion properly.)
Understood. If you get too close to the current standard library, you begin to think it is the same as Scala. For me, Scala is the compiler and I love it! I can't heap enough gratitude on Martin and the others who built this. You guys are awesome! (including Miles Sabin who has apparently contributed) But the standard library has thorns I don't like, although there is a lot of code and ideas in it I like.That's true, and I think everyone broadly agrees with that. (See, for example, the argument about views going on in scala-language.) But in this particular case I don't agree that that's a thorn -- I find the symbolic form considerably more glanceable and understandable than the "foldLeft" version. Given this argument, though, it suggests to me that they were dead-on correct having both in the library, which allows projects to establish their own coding standards.
It's turning out to be crazy-powerful and ridiculously expressive, albeit limited in focus.
But without experimenting, we can't prove some issues one way or the other in the marketplace.Yep. Ultimately, these arguments are irrelevant -- you have to see what actually works.
One more point: I remember *exactly* this argument being leveled at Java in the early days. (I was one of the earliest hardcore adopters, back when everyone knew that Java was only intended for client plugins.) This whole "object-oriented" thing was weird and confusing, and nobody understood it, as opposed to C, which was nicely comprehensible. So the language clearly wasn't going to go anywhere.