Live data from Hacker News

Ooh Ooh My Turn Why Lisp? (2008)

smuglispweeny.blogspot.com

131–140 of 160 posts

Re: Ooh Ooh My Turn Why Lisp? (2008)

#131
post #123

Earlier quoted context omitted.

This is the first I've heard of Shen, so I can't say. However the Racket engineers, particularly Matthias Felleisen, are doing cutting-edge research into types. Typing is not a solved problem, because if it was, there wouldn't be a static vs dynamic type debate that lingers ad nauseum. Racket is in an interesting sweet spot for typing research because it is a traditional lisp with dynamic types, to which gradual typi…

"Typing is not a solved problem, because if it was, there wouldn't be a static vs dynamic type debate that lingers ad nauseum." Could you clarify? Surely even if typing was completely solved, we would still have debates of that kind, because there are benefits to both approaches and there will always be people preferring one or another.

> because there are benefits to both approaches and there will always be people preferring one or another

And that is exactly my point: people prefer one or the other because it is not a solved problem, there is no universally accepted way.

Re: Ooh Ooh My Turn Why Lisp? (2008)

#132

Earlier quoted context omitted.

It might be good to point out to you that the general industry cares very little about things like this. Racket could have literally the most advanced and robust type system out of all programming languages in existence, and still be used by the same amount of people as today and have a hard time convincing anyone else to use it. What makes a language popular from what I have seen are libraries, frameworks, and commu…

The general industry is in fact starting to care about static typing; I've seen it happening lately. The last batch of hot languages included a lot of untyped languages like Python, Ruby, and JS. But the latest batch of rising star languages are typed, eg Go, Rust, Scala. And C/C++, C#, and Java are still all going strong. People are no longer buying the myth that the benefits of static typing can only be gained at t…

Don't forget Apple's new flagship language, Swift.

Re: Ooh Ooh My Turn Why Lisp? (2008)

#133
post #127

Earlier quoted context omitted.

You should never use CLJS because then you'll hate going back to JS.

Strange comment. That's like saying "never use C++ because then you'll hate going back to C" or "never use an automobile because then you'll hate riding horses."

Your analogies don't help me understand why you think it is strange...

Re: Ooh Ooh My Turn Why Lisp? (2008)

#134
post #33
post #32

Earlier quoted context omitted.

You know about metalua, right? http://metalua.luaforge.net/

Yes, I wanted a version of Lua with Macro's that reused familiar syntax (for lispers), that can run on LuaJIT, and is implemented in Lua completely.

https://github.com/baguette/lemma

I've unfortunately let it languish for the last few years, but I'm about to pick back up a bit for the 2016 Lisp Summer Game Jam. I've got a handful of big, backward-compat-breaking changes in the queue, but it should start to stabilize again within a couple of weeks.

Re: Ooh Ooh My Turn Why Lisp? (2008)

#135
post #133

Earlier quoted context omitted.

Strange comment. That's like saying "never use C++ because then you'll hate going back to C" or "never use an automobile because then you'll hate riding horses."

Your analogies don't help me understand why you think it is strange...

I'm sorry to hear that.

Re: Ooh Ooh My Turn Why Lisp? (2008)

#136

Earlier quoted context omitted.

do you have a source for that? it's not that i don't believe you. it's that i am interested. :) i have seen that one powerpoint from a while back where they used their own scheme dialect to script things. but i thought i had read that when they moved to the ps4 they left that behind and used c++ tooling for the same needs.

The scheme they have been using was PLT Scheme, which was renamed Racket.

ahh. i know racket was plt scheme originally. but from my understanding, naughty dog was using their own lisp/scheme and now no longer uses that system.

https://en.m.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp

your comment made it sound like they had returned to using a lisp but had chosen to use racket this time around.

Re: Ooh Ooh My Turn Why Lisp? (2008)

#137

Earlier quoted context omitted.

The scheme they have been using was PLT Scheme, which was renamed Racket.

ahh. i know racket was plt scheme originally. but from my understanding, naughty dog was using their own lisp/scheme and now no longer uses that system. https://en.m.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp your comment made it sound like they had returned to using a lisp but had chosen to use racket this time around.

My understanding is that they are currently using Racket, but I don't work there. This is often mentioned in the Racket community, I think one of the ND engineers spoke at a lisp conference recently about it.

Re: Ooh Ooh My Turn Why Lisp? (2008)

#138
post #123

Earlier quoted context omitted.

This is the first I've heard of Shen, so I can't say. However the Racket engineers, particularly Matthias Felleisen, are doing cutting-edge research into types. Typing is not a solved problem, because if it was, there wouldn't be a static vs dynamic type debate that lingers ad nauseum. Racket is in an interesting sweet spot for typing research because it is a traditional lisp with dynamic types, to which gradual typi…

"Typing is not a solved problem, because if it was, there wouldn't be a static vs dynamic type debate that lingers ad nauseum." Could you clarify? Surely even if typing was completely solved, we would still have debates of that kind, because there are benefits to both approaches and there will always be people preferring one or another.

The reason typing is not a solved problem is this: there are valid programs which can be expressed in an untyped language that cannot be (directly) expressed in a typed one at the moment. For example:

    (define (foo p?)
      (if p?
        42
        "forty-two"))
What is the type of `foo`? It could be `bool -> int` or `bool -> string`, depending on the result of `p?`! In an untyped language, this is a perfectly valid program. In a typed language, this presents a type error, even if `p?` happens to always result in `true` or always result in `false`. The programmer reading the program knows that if `p?` is always `true`, then the type of `foo` is `bool -> int`, and that if `p?` is always `false`, the type is `bool -> string`. However, this program, as-is, is will be rejected as ill-typed.

In a language providing sum types, we can work around this by using a type like `(int * string) either`:

    (define (foo p?)
      (if p?
        (left 42)
        (right "forty-two")))
Where `left` and `right` are type constructors for values of type `('a * 'b) either`. Now, the type of `foo` is `bool -> (int * string) either`. This workaround effectively adds a run-time tag to the `either` values to distinguish the `left` case from the `right` case, which is essentially the way dynamically checked languages operate for values of all types but in a more restricted, specific, and arguably meaningful form. In many (most?) languages with sum types, the language will ensure that the programmer always checks the tag of the `either` values before accessing the underlying "actual" value -- this is the only way to guarantee type safety while ensuring that the program does not barf due to a "type" error at run-time.

Now, it could be argued that the typing problem presented above is basically solved by sum types. But it could also be argued that this doesn't really solve the problem, because what we'd really like is a way to specify that the type of `foo` depends on the result of `p?`, which could maybe be written as `p:=bool -> (p ? int : string)`, for example. Perhaps dependent typing could help us come to a true solution for this case, but there are other cases where other solutions will be needed.

According to Benjamin C. Pierce in Types and Programming Languages:

"Being static, type systems are necessarily also conservative : they can categorically prove the absence of some bad program behaviors, but they cannot prove their presence, and hence they must also sometimes reject programs that actually behave well at run time. ... The tension between conservativity and expressiveness is a fundamental fact of life in the design of type systems. The desire to allow more programs to be typed -- by assigning more accurate types to their parts -- is the main force driving research in the field.[0]

In essence, while there is already a vast array of programs we already know how to type, and while it's possible to work around cases that resist typing, type theory is still an active field of research with plenty of open questions yet to be answered. The corollary to this is that there are still valid reasons to prefer untyped languages to typed ones, as my sibling commentor pointed out. The day when typing is solved is the day people can no longer not look like an bozos for preferring untyped languages, but until that day comes, untyped languages remain fundamentally more expressive than typed ones (in the sense that they're fundamentally capable of expressing more programs[1]).

---

[0]: Pierce, Benjamin C. Types and Programming Languages. MIT Press, 2002. §1.1, pp. 2,3.

[1]: There's also a sense in which typed languages are more expressive than untyped ones, and that's the sense that they are capable of expressing more properties of the program as part of the program itself.

Re: Ooh Ooh My Turn Why Lisp? (2008)

#139
post #123

Earlier quoted context omitted.

"Typing is not a solved problem, because if it was, there wouldn't be a static vs dynamic type debate that lingers ad nauseum." Could you clarify? Surely even if typing was completely solved, we would still have debates of that kind, because there are benefits to both approaches and there will always be people preferring one or another.

The reason typing is not a solved problem is this: there are valid programs which can be expressed in an untyped language that cannot be (directly) expressed in a typed one at the moment. For example: (define (foo p?) (if p? 42 "forty-two")) What is the type of `foo`? It could be `bool -> int` or `bool -> string`, depending on the result of `p?`! In an untyped language, this is a perfectly valid program. In a typed l…

This is quite a nice write-up, thank you. Regarding this point:

>because what we'd really like is a way to specify that the type of `foo` depends on the result of `p?`

Is this situation not resolved by allowing p? to not be a bool necessarily but also a sum type that informs foo which case of a different sum type to return?

Anyway, I like your footnote [1] which, for me, is what allows a typed program to actually be more expressive, in the sense that you can literally express the types in your head as you code, which is difficult or simply not provided in a dynamic language, despite that most developers will be "thinking in types" regardless of typing of the language.

Now, "expressive" also often means "elegant" because you can express an idea easily with less verbosity in a dynamic language.

A language with type inference is an interesting medium that sort of removes the expressivity of explicit type annotations while gaining the expressivity of a dynamic language in some respects.

Re: Ooh Ooh My Turn Why Lisp? (2008)

#140
post #123

Earlier quoted context omitted.

"Typing is not a solved problem, because if it was, there wouldn't be a static vs dynamic type debate that lingers ad nauseum." Could you clarify? Surely even if typing was completely solved, we would still have debates of that kind, because there are benefits to both approaches and there will always be people preferring one or another.

The reason typing is not a solved problem is this: there are valid programs which can be expressed in an untyped language that cannot be (directly) expressed in a typed one at the moment. For example: (define (foo p?) (if p? 42 "forty-two")) What is the type of `foo`? It could be `bool -> int` or `bool -> string`, depending on the result of `p?`! In an untyped language, this is a perfectly valid program. In a typed l…

In Shen, we easily typecheck foo to the specific values 42 and "forty-two", not merely either String or Int.

    \\ enforce type checking
    (tc +)

    \\ create a forty-two type
    (datatype forty-two
      _______________
      42 : forty-two;
      ________________________
      "forty-two" : forty-two;)

    \* example

    (7+) 42
    42 : number
    (8+) 42 : number
    42 : forty-two
    (9+) 43
    43 : number
    (10+) 43 : forty-two
    type error

    *\

    \\ define our foo that takes a boolean
    \\ value and returns a forty-two
    (define foo
      { boolean --> forty-two }
      X -> (if X 42 "forty-two"))

    \* example

    (4+) (== (forty-two true) 42)
    true : boolean

    (5+) (== (forty-two false) "forty-two")
    true : boolean

    *\
Post reply on HN