Live data from Hacker News

BLisp: A Statically Typed Lisp Like Language

ytakano.github.io

1–10 of 51 posts

Re: BLisp: A Statically Typed Lisp Like Language

#2
Since the point of s-expression syntax/homoiconicity is macros, I'm surprised to not see any mention of them in the feature list linked here. Does BLisp support macros? If so, what kind?

Also, is there an example of the type inference working?

Re: BLisp: A Statically Typed Lisp Like Language

#3
I always feel that for lisp-like languages it's just not a good idea to make them statically typed. Their power is derived from macros and the fact that code is data and the other way around.

For statically typed languages, they only feel ergonomic to me if they have highly specialized syntax and if they really leverage the type-system (which is often in conflict with macros and runtime flexibility).

Re: BLisp: A Statically Typed Lisp Like Language

#4

I always feel that for lisp-like languages it's just not a good idea to make them statically typed. Their power is derived from macros and the fact that code is data and the other way around. For statically typed languages, they only feel ergonomic to me if they have highly specialized syntax and if they really leverage the type-system (which is often in conflict with macros and runtime flexibility).

How do you feel about typed Racket?

Re: BLisp: A Statically Typed Lisp Like Language

#5

I always feel that for lisp-like languages it's just not a good idea to make them statically typed. Their power is derived from macros and the fact that code is data and the other way around. For statically typed languages, they only feel ergonomic to me if they have highly specialized syntax and if they really leverage the type-system (which is often in conflict with macros and runtime flexibility).

Seems like you could still have macros, they would just evaluate before type checking. Rust works this way

Re: BLisp: A Statically Typed Lisp Like Language

#6

I always feel that for lisp-like languages it's just not a good idea to make them statically typed. Their power is derived from macros and the fact that code is data and the other way around. For statically typed languages, they only feel ergonomic to me if they have highly specialized syntax and if they really leverage the type-system (which is often in conflict with macros and runtime flexibility).

> I always feel that for lisp-like languages it's just not a good idea to make them statically typed. Their power is derived from macros and the fact that code is data and the other way around.

I completely agree with the idea that their power is derived from macros, but I vehemently disagree that macros are incompatible with a static type system. The type of a form can be just a simple ADT

    data Form = FInt Int
              | FCons Form Form
              | FNil
              | FString String
              | ...
and a macro is just a function taking Form as arguments and returning a Form. With standard HM type inference, your macros can look exactly like they do in a dynamically typed Lisp. If the backquote is just a reader macro that produces a Form:

    (defmacro double (x)
       `(* x x))
that would be expanded into

    (defmacro double (x)
       (FCons '* (FCons x (FCons x FNil))))
and type inference would determine that the type of double is

    double :: Form -> Form
And destructuring Forms is just normal ADT pattern matching.

Re: BLisp: A Statically Typed Lisp Like Language

#8
post #6

I always feel that for lisp-like languages it's just not a good idea to make them statically typed. Their power is derived from macros and the fact that code is data and the other way around. For statically typed languages, they only feel ergonomic to me if they have highly specialized syntax and if they really leverage the type-system (which is often in conflict with macros and runtime flexibility).

> I always feel that for lisp-like languages it's just not a good idea to make them statically typed. Their power is derived from macros and the fact that code is data and the other way around. I completely agree with the idea that their power is derived from macros, but I vehemently disagree that macros are incompatible with a static type system. The type of a form can be just a simple ADT data Form = FInt Int | FCo…

> and a macro is just a function taking Form as arguments and returning a Form

Why would it not just be a normal function then?

Re: BLisp: A Statically Typed Lisp Like Language

#9
post #6

Earlier quoted context omitted.

> I always feel that for lisp-like languages it's just not a good idea to make them statically typed. Their power is derived from macros and the fact that code is data and the other way around. I completely agree with the idea that their power is derived from macros, but I vehemently disagree that macros are incompatible with a static type system. The type of a form can be just a simple ADT data Form = FInt Int | FCo…

> and a macro is just a function taking Form as arguments and returning a Form Why would it not just be a normal function then?

Because it's evaluated at compilation time.

Re: BLisp: A Statically Typed Lisp Like Language

#10
post #5

I always feel that for lisp-like languages it's just not a good idea to make them statically typed. Their power is derived from macros and the fact that code is data and the other way around. For statically typed languages, they only feel ergonomic to me if they have highly specialized syntax and if they really leverage the type-system (which is often in conflict with macros and runtime flexibility).

Seems like you could still have macros, they would just evaluate before type checking. Rust works this way

To my knowledge, Rust's macros are not generally safe/sound by definition. And that can be a big problem down the line. Compare it to Scala. When they developed Scala 3, they changed macros and dropped a lot of their powers to make the safe/sound by definition and compatible with the typesystem. But they are now severely restricted when compared to Lisp macros.

EDIT: here's an example of a discussion about that in Rust: https://github.com/rust-lang/unsafe-code-guidelines/issues/2...

Post reply on HN