Live data from Hacker News

Loop: a programming language for the JVM inspired by Haskell and Ruby

looplang.org

11–20 of 41 posts

Re: Loop: a programming language for the JVM inspired by Haskell and Ruby

#11
post #4

I think it's quite misleading to list Haskell in the title: the only common thing between Loop and Haskell that I've found is pattern matching, and that's not even exclusive to Haskell -- other languages have it. Besides, it's not clear from the intro that Loop's pattern matching is as powerful as Haskell's (especially with all the extensions). Finally, pattern matching is really a syntactic sugar over the case/switc…

Pattern-matching is not sugar over "case".

Pattern-matching means that the branching primitive not only dispatches to different code based on an input tag, but also that it places different values of different types in scope according to the branch.

Most languages only branch on booleans, without gaining any type information at all. This is actually a big problem and relates to the nullability problem, explained at: http://existentialtype.wordpress.com/2011/03/15/boolean-blin...

For example, in C:

  switch(ptr) {
  case NULL: ... handle null case ...
  default: ... use ptr as if it weren't NULL ...
  }
This is unsafe -- because nothing prevents you from using ptr in the "NULL" case, and the compiler does not give you anything in the non-NULL case.

In Haskell:

  case ptr of
    Nothing -> ... can't use ptr as a value here,
                   it's wrapped with Maybe ...
    Just x -> ... pattern-matching gave us "x" of
                  the correct type.
                  We can now safely use it.

Re: Loop: a programming language for the JVM inspired by Haskell and Ruby

#12
Being functional in nature, Loop doesn't have any of the baggage of the host platform (Java)

I don't see much that's functional in this language, but this statement made me laugh. It looks like a lot of Java's baggage is still alive and well in this language, like exceptions (quite un-Haskell-like)

Re: Loop: a programming language for the JVM inspired by Haskell and Ruby

#15

> Polymorphism in this instance is simply allowing you to call the same function with an integer and string respectively. Er... no, that's not polymorphism, that's overloading.

In computer science, polymorphism is a programming language feature that allows values of different data types to be handled in a uniform manner.

This may be ad hoc polymorphism (often synonymous with overloading) - or parametric polymorphism (as in ML or Haskell); but it's unclear what they actually do without some language semantics.

Re: Loop: a programming language for the JVM inspired by Haskell and Ruby

#18

Being functional in nature, Loop doesn't have any of the baggage of the host platform (Java) I don't see much that's functional in this language, but this statement made me laugh. It looks like a lot of Java's baggage is still alive and well in this language, like exceptions (quite un-Haskell-like)

> like exceptions (quite un-Haskell-like)

Haskell has exceptions [1].

[1] http://www.haskell.org/haskellwiki/Exception

Re: Loop: a programming language for the JVM inspired by Haskell and Ruby

#19
Perhaps this isn't the place for the question, but I'll ask anyway. Is there any JVM-based language that excludes any code from being compiled that is not directly implemented in that language? For example, any code that would deny the use of java.io or java.lang?

The reason I ask is because Clojure and Scala both suffer from the ability to call legacy code. While some think this is a good idea, it makes the whole scalable, safe/functional paradigm completely unstable. Is there any language out there that forces the developer to use only things written in the specific language its since that would be the only safe platform?

Re: Loop: a programming language for the JVM inspired by Haskell and Ruby

#20
I take issue with

   Haskell programmers may be familiar with this as a do 
   block, and for Schemers, this is the equivalent of a
   begin sequence. However, unlike Haskell, in Loop, a 
   sequence is guaranteed to execute in order.
A do block is syntactic sugar over >>= (bind) and is monadic in nature. And the IO monad (which is relevant to the example that involved printing things.) is a construct which guarantees that the parts will execute in order. That's kinda the point. That he got it wrong makes me not trust the language. He shouldn't claim to have been "Inspired by Haskell" if he doesn't really know it.

Also in Haskell the pattern [x:xs] matches a list with one element, which is a list with at least one element, so [[1,2,3]] (== (1:2:3:[]):[]) gets matched with x = 1 and xs = [2,3]. That differs from loop's pattern matching. But [x] still matches a list with only one element. What does [x:[]] match? If you are going by [x:xs] matches [1] with x = 1 and xs = [], then surely [x:[]] will match as well.

Also, if you are making a functional programming language, you know one that uses recursions instead fo for loops, why do you call it Loop? I didn't see one loop in any of the examples. It's just silly.

EDIT: Oh, and if Nothing really is a subtype of everything, then 5 + Nothing should typecheck right? Not " It is a type error to attempt to compute with Nothing." Since Nothing is a Integer, since it subtypes everything. I don't understand. Is + special in hating Nothing? Nothing.add(5) would return Nothing, right? So why not Nothing + 5. Oh, but wait, Nothing is a subtype of string, so Nothing + 5 means string concatenation, right? You did say a + b where a is a string casts b to a string, didn't you? It's inconsistent and I don't think it has the proper semantics.

Post reply on HN