against I assume a dozen or so hard-core Typesafe developers
On Mon, Mar 5, 2012 at 20:45, Shelby <she...@coolpage.com> wrote:
> Per Soc's comment, I am belatedly posting this suggestion to the
> mailing list.
>
> https://issues.scala-lang.org/browse/SUGGEST-18
>
> Attempting to bump up the priority of this suggestion. Can anyone
> comment on how extensive this change would be?
That would break a lot of code to absolutely no advantage that I can
see. Specifically:
1. One needs to implement three methods to define a Seq (iterator,
apply and length), so the argument that it is hard holds no water.
2. No example of a situation where a something might want to define a
non-standard collection and return it through unapplySeq was given,
and I, for one, can't think of one.
> With Ceylon 1.0 shooting for release this year (first alpha released
> already), Scala might benefit from more experimentation with creating
> easy-to-use libraries that will be competitive and best matched to the
> mainstream.
I'd put more faith in that with Java compatibility was a stated goal
of Ceylon. Last time I looked, it was explicitly not a given.
> An example of that pragmatism, I assume Ceylon is going to avoid the
> type inference binary compatibility problem of Scala, by allowing only
> type inference only where the impacts are local:
>
> http://ceylon-lang.org/documentation/1.0/introduction/#type_aliases_and_type_inference
> http://www.slideshare.net/mircodotta/managing-binary-compatibility-in-scala
If only type inference was the major cause of binary compatibility
problems! Type inference is a smallish detail, which is simply a
matter of carefulness.
> I assume Gavin will make other clever design decisions like this
> (corner cases he is missing?), and the Scala community needs to be
> free to compete without having to carry the baggage of the standard
> library (i.e. any mistakes that become apparent over time, and the
> first being that it is apparently monolithic, since the pattern match
> feature of the compiler is conflated) around in everything. I heard in
> the Paul Philips interview that there are already weird corner cases
> in the standard library.
I assume, I heard... can't you can actually come with facts, such as
"I wrote a program to do X, and had the trouble Y"?
> So I am asking if we perhaps need to divert some our priority
> attention from type theoretic focus (e.g. efforts to make the current
> compiler perfectly sound), and deal with other bigger picture
> pragmatic issues like first? Eric Raymond (Cathedral & Bazaar open
And here's the part where you threw away any credibility you might
have. The biggest effort spent all through 2.9x has been on *Eclipse
IDE support*. Yes, some individuals have been working on "type
theoretic stuff" -- though nothing of the like you mention -- but it's
been so far from the main focus that it hasn't even appeared anywhere
but papers and conferences -- certainly not the compiler itself. Other
efforts were given to documentation, to having simple and efficient
installers, to getting the source control on github so that all may
contribute more easily, to making the sites look good, to getting an
integrated offering of tools to go together with the language, etc.
So, basically, for the past year and a half Scala has been nothing but
pragmatic, which means that you have absolutely no knowledge
whatsoever about what is actually being done. An *interested*
outsider, one who had bothered to give even a cursory look at what's
happening, would have a much better chance of gaining support. If for
no other reason, you'd at least look like you know what you were
talking about, which, right now, you are not.
> source manifesto) claims that large numbers random monkeys banging on
> the open bazaar of code will beat the closed cathedral of experts by
> orders of magnitude (and this is apparently being proven in the real
> world results of open source vs. closed source). So I am pondering
Note that Eric Raymond extrapolated that from a single example, and
ignoring counter examples to his theory. There's absolutely no
evidence or study that gives credence to what he said.
> that maybe we need to prioritize the issues of openness, i.e. de-
> conflation in this case.
And what's that to do with what Eric said, no matter whether he's
right or wrong?
>
> Exhibits:
>
> http://www.catb.org/esr/comscore/ (open source Android vs. closed
> source iPhone)
iPhone still beats Android by a huge margin. I know: I have an
Android, my wife has an iPhone, and I don't want to migrate to iPhone
due for personal reasons. But I'm under no illusions of how much
better the iPhone is.
> http://ceylon-lang.org/documentation/1.0/faq/#when_will_it_be_ready
Show me the money, as they say. That's just a wishlist.
> http://blog.joda.org/2011/11/scala-feels-like-ejb-2-and-other.html
Coming from someone who never used Scala and actually complains about
stuff like where the type is related to the variable name.
> http://blog.joda.org/2011/11/scala-ejb-2-feedback.html
Oh, him again!
Well, it's 2.9.1, and Scala 2.8 collections haven't stopped anyone so far.
> http://grahamhackingscala.blogspot.com/2011/12/will-typesafe-address-scala-criticisms.html
That one I haven't read, but, honestly, I'm not much in the mood to do
so either.
--
Daniel C. Sobral
I travel to the future all the time.
The "obscure typing soundness" bugs, and other bugs whose relevance
may not be obvious to you, do not live in a separate universe where
they have no bearing. Everything is intertwined. The luxury of
seeing soundness bugs as unimportant is a viewpoint which you can
possess only because we do not.
I assume that could go on for years to perfect all.
-- Francois ARMAND http://fanf42.blogspot.com http://www.normation.com
The code which calls the pattern matcher is not the code which defines
the methods the pattern matcher will call, which I consider a big
problem with this approach. In the end, of course, yes, one could have
a compiler switch so that two completely different (and incompatible)
implementations could be selected from. From my biased wording, I
think one can easily see I do not consider this a good idea. :-)
>> to absolutely no advantage that I can
>> see. Specifically:
>>
>> 1. One needs to implement three methods to define a Seq (iterator,
>> apply and length), so the argument that it is hard holds no water.
>
> I see dozens of methods and multiple inheritance:
>
> http://www.scala-lang.org/api/current/index.html#scala.collection.Seq
Yes, so what? Here, let's write one on the REPL:
scala> class X extends Seq[Int] {
| def length = 2
| def apply(n: Int) = n match { case 0 => 1 case 1 => 2 }
| def iterator = Iterator(1, 2)
| }
defined class X
There, three methods.
>> 2. No example of a situation where a something might want to define a
>> non-standard collection and return it through unapplySeq was given,
>> and I, for one, can't think of one.
>
> I (or others) might want to implement an entirely orthogonal
> collections library, e.g. based on category theory:
>
> http://stackoverflow.com/questions/1722726/is-the-scala-2-8-collections-library-a-case-of-the-longest-suicide-note-in-hist/7397388#7397388
>
> [...]
And using Seq with pattern matching prevents you from doing so how,
exactly? Remember that unapplySeq is not defined on the collection
class, but on a companion object. All the companion object needs to do
is convert what it receives into a Seq.
>
>> I'd put more faith in that with Java compatibility was a stated goal
>> of Ceylon. Last time I looked, it was explicitly not a given.
>
> Some claim that Java interopt may be more pain than it is worth in
> some cases:
>
> http://codahale.com/downloads/email-to-donald.txt
> http://grahamhackingscala.blogspot.com/2011/12/will-typesafe-address-scala-criticisms.html
True, but how can people start "creating easy-to-use libraries" (your
words) that will NOT be compatible with Java? What use it will be to
the "ramping community from of huge pool of excited Java developers"?
>
>
>> If only type inference was the major cause of binary compatibility
>> problems! Type inference is a smallish detail, which is simply a
>> matter of carefulness.
>
> But type inference binary breakage is opaque, because programmer
> didn't type a changed method signature.
Yes, and it can be fixed by having the programmer declare the return
type of his functions. That's something a code style tool can handle.
>> Yes, some individuals have been working on "type
>> theoretic stuff" -- though nothing of the like you mention -- but it's
>> been so far from the main focus that it hasn't even appeared anywhere
>> but papers and conferences -- certainly not the compiler itself.
>
> I perused some recent bug reports, and see effort to fix corner cases
> of the type system. I assume that could go on for years to perfect
> all.
Well, if there are bug reports about what you call "corner cases" of
the type system, and no bug reports about replacing Seq in unapplySeq
with something else, I think that should tell you something about
what's pragmatic and what's not. Bug reports arise from bad things
happening to code that is actually being used.
> I agree that is useful. I am pondering if such perfection can take
> temporary backseat in priority to more deeply rooted, fundamental
> issues that may have wider impact.
Oh, sure. I can see how that's going to play out. "Sorry, Twitter. I
know you are having trouble because some valid code you wrote is not
compiling as expected, but we decided that's a corner case, so we'll
put it in the back-burner. Meanwhile, I'm sure you'll be excited to
know that the next version of Scala will let you replace the "Seq" in
"unapplySeq" with an entirely different class of your own choosing!"
>
> For me so far, those might be (not sure):
>
> * lack of first-class union type
Oh-hoh! Yes, I'd like union types too, but how many of Tiobe's top-20
languages (http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html)
have them? How many Java programmers would even know how to use or
what to do with them?
> * inability to use the pattern matching with sequences without forcing
> the standard library.
And I'm yet to see a single use case of that.
>> So, basically, for the past year and a half Scala has been nothing but
>> pragmatic, which means that you have absolutely no knowledge
>> whatsoever about what is actually being done.
>
> I had the impression (even before his comments today) for example that
> Adriaan might be a key implementator on virtual pattern matcher and on
> any future union type, and for example I read a bug report where he is
> stumped for days on some obscure typing soundness bug. Perhaps my
> sample size was too small on where the priorities are in the
> *PRESENT*.
One developer is certainly too small, so it's no surprise that your
results are skewed when you pick one whose specialty and research is
Scala's type system. But let's not get that in the way. The soundness
bug stumping Adriaan, afaik, was related to the virtual pattern
matcher. The virtual pattern matcher, on the other hand, does this:
1. Replaces the current pattern matcher, which has many serious bugs,
with one that doesn't. It will have its own share of bugs, sure, but,
for now, it already solves a bunch of bugs that have, for instance,
gotten in the way of Yammer. I think getting pattern matching to
actually work beyond trivial cases is pretty pragmatic, and of far
surpassing importance than changing the return type of unapplySeq.
2. Turns pattern matching into method calls to a collection that can
then be replaced, just like for-comprehensions! If you think replacing
"Seq" in "unapplySeq" brings flexibility, sure you can appreciate the
gains in flexibility from being able to replace pattern matcher's
whole engine!
>
>> An *interested*
>> outsider, one who had bothered to give even a cursory look at what's
>> happening, would have a much better chance of gaining support. If for
>> no other reason, you'd at least look like you know what you were
>> talking about, which, right now, you are not.
>
> Additionally I have been aware there is a lot of effort on immutable
> collections (tries, etc), concurrency and parallelism libraries, etc..
Actually, ctries are mutable, not immutable. Yes, the developer whose
orientation and research is concurrency and parallelism is doing that.
There are others as well. You don't consider concurrency and
parallelism a pragmatic issue?
Also, RedBlack was replaced and someone wrote a mutable AVL so that
mutable TreeSet and TreeMap could be created. The interesting thing
here, however, is that these efforts were *not* from EPFL/TypeSafe,
but from people working on other stuff who actually felt the need to
do so. These are pragmatic by definition: they needed it, so they
wrote it.
>
> I have sense there is a lot of being thrown at the standard
> collections, and I am asking whether some effort should be thrown at
> de-coupling the standard library from the compiler.
Well, guess what, Scala collections are a big deal. Writing a new
alternative collection to the one written just two years ago would be
a waste of effort: if not the new library, certainly the effort spent
two years ago. Let others create entirely new collection libraries.
People have done so in Java, so what's stopping anyone in Scala? And
just as Scala has conversions to and from Java libraries, yes, people
will have need to provide conversions to and from Scala library. Which
you'll then be able to use when returning something with unapplySeq.
>
>> > source manifesto) claims that large numbers random monkeys banging on
>> > the open bazaar of code will beat the closed cathedral of experts by
>> > orders of magnitude (and this is apparently being proven in the real
>> > world results of open source vs. closed source). So I am pondering
>>
>> Note that Eric Raymond extrapolated that from a single example, and
>> ignoring counter examples to his theory. There's absolutely no
>> evidence or study that gives credence to what he said.
>
> Linux (pretty much every where except desktops)
> Firefox
> Android
> etc..
Err, yes? Do you mean quality, which is what Eric said, or popularity?
Since you didn't actually show any data whatsoever, I'll assume from
your example latter on that you mean popularity -- which is NOT what
Eric said. As far as popularity is concerned, Windows is more popular
than Linux, and Internet Explorer is more popular than Firefox. Linux
is used in a bunch of other places because it is free. Which is all
irrelevant, because Eric was talking about quality, not popularity.
Please, do not even bother to answer this point if you are not going
to mention a peer reviewed scientific study to back the argument.
Anecdotes are not data.
>
>> > that maybe we need to prioritize the issues of openness, i.e. de-
>> > conflation in this case.
>>
>> And what's that to do with what Eric said, no matter whether he's
>> right or wrong?
>
> Forcing the standard library, means in this case forcing one library
> culture of a dozen people or so, on the entire POTENTIAL community
> (thus which we may never attain).
Forcing the standard library? You are much mistaken! If you replace
the standard library with a completely different one than has a
scala.collection.Seq of your choice, I'm pretty sure the compiler will
happily use it.
>
> I think modularity is very important. That is why I think `trait` is a
> brilliant feature of Scala. I wish a light-weight trait was employed
> for pattern matching instead of a heavy-weight one that carries much
> of the standard library in with it.
>
>> > Exhibits:
>>
>> >http://www.catb.org/esr/comscore/(open source Android vs. closed
>> > source iPhone)
>>
>> iPhone still beats Android by a huge margin.
>
> Did you look at the charts?
>
> iPhone has 29% marketshare in USA, Android nearly 50%. Android came
> from behind with only 5% and raced past iPhone.
Popularity, Eric was talking about quality.
>
> The numbers are even more lopsided in the developing markets, which
> are more price and feature-diversity sensitive.
>
>
> [...]
>
>>
>> >http://ceylon-lang.org/documentation/1.0/faq/#when_will_it_be_ready
>>
>> Show me the money, as they say. That's just a wishlist.
>
> iPhone got the money, but lost the marketshare.
>
> For a language, marketshare is critical.
That's not what I meant. What I meant is that the thing in that faq DO
NOT EXIST. Period. The existing beta does not implement what they are
promising. Code that does not exist is no parameter of comparison to
code that exists.
>
>
>> >http://blog.joda.org/2011/11/scala-feels-like-ejb-2-and-other.html
>>
>> Coming from someone who never used Scala and actually complains about
>> stuff like where the type is related to the variable name.
>
> I would rather analyze the substance, than dismiss based on
> allegations about qualifications.
If I found substance to his arguments, I'd do so. Since he doesn't
know Scala, his arguments have no substance. I'm not going to repeat
here the analysis others have done already.
>
> [...]
>
>> Well, it's 2.9.1, and Scala 2.8 collections haven't stopped anyone so far.
>
> Sure?
Sure. If not, show me the evidence. You are the one trying to get
others to do a lot of work to accomplish something you deem desirable,
so you have the burden of proving it is so.
"Everything is intertwined" was intended as a general observation that
often the right path to fixing bugs involves fixing other bugs. It
was not code for "everything is excessively coupled."
On Mar 8, 12:25 am, Daniel Sobral <dcsob...@gmail.com> wrote:That is one way to attack the problem. I would prefer to attack the
> >> If only type inference was the major cause of binary compatibility
> >> problems! Type inference is a smallish detail, which is simply a
> >> matter of carefulness.
>
> > But type inference binary breakage is opaque, because programmer
> > didn't type a changed method signature.
>
> Yes, and it can be fixed by having the programmer declare the return
> type of his functions. That's something a code style tool can handle.
problem the way Ceylon is, by forcing it always with the compiler in
the case the method signature has non-local exports. Why should I have
to run a separate tool to tell me the same thing the compiler can?
My alternative idea is to not put implementation in interfaces,
separate out into mixins, then never allow functions to reference non-
interfaces. Then don't change interfaces without changing their name.
So then you've get modular versioning on a fine-grained scale.
> If I found substance to his arguments, I'd do so. Since he doesn't
> know Scala, his arguments have no substance. I'm not going to repeat
> here the analysis others have done already.
Afaics, that is myopia and an example of what he is talking about
w.r.t. to community.
I found several points of substance in his arguments:
1. Scala's subsumption is a semantic hole and a runtime typing hole.
3. Scala is missing the ability to declare functions pure.
4. Scala's community is academic-centric, thus so are some of the
design decisions, priorites, and style of dialogue.
They are not superior. They are more appropriate in some situations and less in others.
- Option is a common interface, i.e. you can do map, flatMap. I don't think that A | None could do that without pimping.
- The union type are useful for type safe data structures which need to distinguish sub types which still have an _intersection_ of common interface.
To give an example : I have a 'horizontal and vertical' tree like structure which distinguishes left and top elements from inner elements. I ended up having the following traits:
Branch, BranchLike, Child, ChildBranch, Empty, Leaf, LeafOrEmpty, Left, LeftBranch, LeftChild, LeftChildOption, LeftNonEmpty, LeftNonEmptyChild, LeftTopBranch, Next, NextOption, NonEmpty, NonEmptyChild, RightBranch, RightChild, RightChildOption, RightNonEmptyChild, RightTopBranch, TopBranch -- a real pita obviously, all to get a nice compile time type check for the whole structure.
[...]
> Hoare, the creator of `null`, said `null` was his $billion mistake.
>
> I read that Ceylon is the first language to fix it. I hope Scala
> remains the most advanced typing language on the JVM.
that's none sense. you can fix NPRs in scala if you want to. if you want safety from possible null returns from java libraries, wrap them appropriately. simple.
i think most bugs with respect to val initializations have been fixed. as far as my own projects are concerned, i haven't seen NPEs in a while.
[...]
> I found several points of substance in his arguments:
>
> 1. Scala's subsumption is a semantic hole and a runtime typing hole.
>
> 2. Scala is in some respects a write-only language, because there are
> too many ways to express the same thing (e.g. 9 ways to write a
> function) and because of design choices to make DSLs blend with the
> language. I am not proposing we change this in Scala. I may (or may
> not) create a language (Copute) that compiles to Scala, which is
> cleaner (and more limited), but still we would be coding in Scala for
> a significant portion.
no problem with that, create a new language. Scala will always be embraced because of its bazaar approach, other people will use Python, etc.
> 3. Scala is missing the ability to declare functions pure.
there are multiple options. there is a compiler plugin being developed for @pure, there is the uniqueness and borrowing extension, there is ongoing research into a scala effect systems, there is actors, there is scala-stm, etc. not just the io monad. it boils down to your responsibility to design the system in a consistent way.
>
> 4. Scala's community is academic-centric, thus so are some of the
> design decisions, priorites, and style of dialogue.
one of the biggest plus points for Scala IMO. that's why languages like haskell or scala will survive in the high-level realm; system languages like C will survive in the low level realm, because they are fast, not because they are particularly pretty or academically informed. those that are neither won't have a sustainable development (ruby, groovy, perl, ...). they are well founded and they are constantly improved based on actual research instead of messing around with them. see previous point for an example. scala has the big advantage over other languages such as mozart that it stands on two legs, it is also commercially supported now. try to make a list with other languages having these two legs...
best, .h.h.
Implementation should never be in the interface. Want me to try to
justify that?
+1. Couldn't agree more.
"Scalable" should mean small too, not big only.
--
Seth Tisue | Northwestern University | http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
On Mar 8, 4:51 pm, Ittay Dror <ittay.d...@gmail.com> wrote:On Mar 8, 12:16 am, Shelby <she...@coolpage.com> wrote:On Mar 8, 4:26 am, Ittay Dror <ittay.d...@gmail.com> wrote:you don't need to copy. just create 'class X extends Seq' that implements the three methods in terms of your data collection. e.g, 'def length = this.length'. you have an overhead of creating a new instance instead of returning 'this', but i think this is not really an issue.So if I understand correctly, you are saying wrap the current instance in a new companion instance by reference, where the new instance extends Seq.The implementation in Seq is complete, if the implementation for the three methods are provided.That may work as a special case to interopt with the existing pattern matcher, but afaics companion objects defeat subtyping, thus in general will break modularity of composition. Synonomous with Adriaan's effort to virtualize (to user land) what the pattern matching engine does, I am thinking we should also virtualize the types that Extractors can return, as long they adhere to a minimum set of structural members or nominal trait(s).class MyCollection[A].... object MyCollection { def unapplySeq[A](col: MyCollection[a]) = Some(SeqWrapper(this))
} where SeqWrapper extends Seq an implements the 3 required methods by delegating to MyCollection's methods.Agreed, and that is what I wrote that I assumed you meant. I re-iterate that afaik in general, wrapper delegation breaks subtyping.
On Mar 8, 7:42 am, Kevin Wright <kev.lee.wri...@gmail.com> wrote:
I read the "Distance from the main" section:> On 7 March 2012 23:06, Shelby <she...@coolpage.com> wrote:
>
> > Implementation should never be in the interface. Want me to try to
> > justify that?
>
> That's just a rule. Like many rules, it exists to be bent :)
>
> In practice, things are a little more complicated, and there's a whole
> sliding scale of exactly how stable/abstract things ought to be:
>
> http://www.ibm.com/developerworks/java/library/j-cq04256/
http://www.ibm.com/developerworks/java/library/j-cq04256/#N10215
I believe that section is making the point that instability increases
as abstraction decreases, and that when you must lower abstraction at
least try to stay as close as possible to the main line for that
tradeoff.
I don't think the section is claiming that reducing abstraction is
desirable.
On Mar 8, 5:10 am, Rex Kerr <icho...@gmail.com> wrote:
[...]
> > > Yes, and it can be fixed by having the programmer declare the returnBy 'scripting' in this context you mean you always recompiling all the
> > > type of his functions. That's something a code style tool can handle.
>
> > That is one way to attack the problem. I would prefer to attack the
> > problem the way Ceylon is, by forcing it always with the compiler in
> > the case the method signature has non-local exports. Why should I have
> > to run a separate tool to tell me the same thing the compiler can?
>
> Because forcing boilerplate reduces productivity in important use cases,
> such as scripting. Right now, I use Scala for the vast majority of my
> scripting tasks specifically because it doesn't make me pedantically repeat
> easily-inferred types just to try to help me catch errors that might crop
> up in enterprise-scale projects. I can type out a couple of files quickly,
> do some stuff in the REPL, and bingo!--it works, and with type safety.
dependencies, but does that make binary compatibility not matter?
My prior summary was slightly unclear. I don't mean discard the
> > My alternative idea is to not put implementation in interfaces,
> > separate out into mixins, then never allow functions to reference non-
> > interfaces. Then don't change interfaces without changing their name.
> > So then you've get modular versioning on a fine-grained scale.
>
> This sounds like a refactoring nightmare waiting to happen. Care to
> explain in more detail how this is helpful?
original name and interface.
When programming for separate compilation, i.e. modularity and wide-
area (enterprise or wider, i.e. whole internet) collaboration, then an
interface needs to be a static thing. If you need to change it, give
it a new version, which is just as easily accomplished by creating a
new copy with a new name. The original interface and name do not
disappear.
Implementation should never be in the interface. Want me to try to
justify that?
[...]
> > I found several points of substance in his arguments:As I mentioned before:
>
> > 1. Scala's subsumption is a semantic hole and a runtime typing hole.
>
> Not sure what you mean by "hole".
1. I can ask if a `Man` exists in a collection of only `Woman`. Type
system does not complain due to implicit subsumption to Any.
2. I can add a `Man` to a collection of `Woman`, I get a collection
implicitly subsumed to `Any`, without afaik any possible way to get a
warning, unless I make the collection invariant. I then have a runtime
typing hole, because I can downcast an `Any` to anything with `match`
and cause an exception to be thrown.
In nutshell, afaics the lack of union type means Scala is a unityped
(i.e. dynamic and not static) language in this case.
I don't see how you can do that and not force invariant type
> It is correct, but union types would
> make it potentially better. Having invariant collections available for
> those cases where it's the right thing to do would also be nice. In the
> meantime, declaring the result type once it matters (e.g. method return
> value) is a good strategy to use to make sure you don't have unwanted
> changes in collection type.
parameterization.
I'm sorry, but doesn't the paper say that *automatic* wrappers with
subtyping is impossible? All objects are wrappers, so to say wrappers
and subtyping is impossible is to deny the existence of object
orientation.
(Francois)
> [...]
> The more general point being that any type system is never complete,
> else it isn't Turing-complete.
>
Scala type system is Turing-complete, see:
http://apocalisp.wordpress.com/2010/06/08/type-level-programming-in-scala/
(or just Google for it)
Thanks,
--
Francois ARMAND
http://fanf42.blogspot.com
http://www.normation.com