Live data from Hacker News

Lang Jam: create a programming language in a weekend

github.com

51–60 of 135 posts

Re: Lang Jam: create a programming language in a weekend

#51

As someone that writes a lot in Rust, I have a longstanding dream to make a compiler for a subset of the language, since I don’t use all features of Rust and my hope is that this way I could have fast debug builds (in terms of compilation time) while I develop, with simplified borrow checker and so on. So then I can iterate faster. That’s one of my dreams. But I have not had time to even look at it yet, as the other…

Check out cranelift: https://blog.rust-lang.org/inside-rust/2020/11/15/Using-rust...

Re: Lang Jam: create a programming language in a weekend

#52
post #43
post #23

What kind of language ideas do you folks have? What would your fizzbuzz look like? I'm not sure I've ever seen a more readable compact fizzbuzz than this version in coffeescript ['fizz' unless i%3] + ['buzz' unless i%5] or i for i in [1..100]

I would build around a constrained high-level concept. Something like actors, perhaps. It would be assembly-like, command-oriented. I would then build a visualization environment which shows what the actors are doing, possibly step-by-step. It would show them moving values between registers and buffers. It would show messages passing between actors. It would show new actors create and finished actors die and errors g…

You might like https://en.wikipedia.org/wiki/ToonTalk

Re: Lang Jam: create a programming language in a weekend

#53
post #23

What kind of language ideas do you folks have? What would your fizzbuzz look like? I'm not sure I've ever seen a more readable compact fizzbuzz than this version in coffeescript ['fizz' unless i%3] + ['buzz' unless i%5] or i for i in [1..100]

My favourite FizzBuzz is in Haskell, I found it in this talk by Kevlin Henney[0], and looks like this: fizzes = cycle ["", "", "Fizz"] buzzes = cycle ["", "", "", "", "Buzzes"] words = zipWith (++) fizzes buzzes numbers = map show [1..] fizzbuzz = zipWith max words numbers Henney explains in detail in the video, but it makes use of lazy evaluation to create an infinite list of FizzBuzzes, and also uses no if statemen…

"max" seems like an odd choice. Wouldn't that start to fail at large numbers?

Edit: Nevermind, max is lexicographic, not based on string length. Brain fart.

Re: Lang Jam: create a programming language in a weekend

#54
post #29
post #23

What kind of language ideas do you folks have? What would your fizzbuzz look like? I'm not sure I've ever seen a more readable compact fizzbuzz than this version in coffeescript ['fizz' unless i%3] + ['buzz' unless i%5] or i for i in [1..100]

I'd like a language that makes it easy to mock and dependency inject without doing anything special. IE, if in my business logic, I write "new Foo()", I'd like to be able to write a unit test where I say something like, "whenever I wrote 'new Foo()' swap in this mock object instead." Or, in a module that's an entry-point, I'd like to say, "whenever I wrote 'new Foo()' swap in this subclass instead." I've spent so muc…

Clojure does something very much like this using the with-redefs [0] form.

If you have a function like:

    (defn send-mail [receiver-ids title text]
      ...)
You can mock it out in your tests like:

    (with-redefs [send-mail (fn [r-ids title text]
                              (println r-ids title text))]
      ;; send-mail will just print
      ...)
[0] https://clojuredocs.org/clojure.core/with-redefs

Re: Lang Jam: create a programming language in a weekend

#55
post #23

What kind of language ideas do you folks have? What would your fizzbuzz look like? I'm not sure I've ever seen a more readable compact fizzbuzz than this version in coffeescript ['fizz' unless i%3] + ['buzz' unless i%5] or i for i in [1..100]

Gotta wait to see what the theme is, but I’m going to be building a 2D tree language (https://jtree.treenotation.org/designer/). Probably with a spreadsheet IDE like https://youtu.be/0l2QWH-iV3k

Re: Lang Jam: create a programming language in a weekend

#56
post #50
post #48

Earlier quoted context omitted.

I'd like a GC (no borrow checker) version of Rust. There's so many cool concepts in the language that I'd like to know how useful it is in different contexts. (Compiled without a VM, option types, no nulls, easy error handling without exceptions...)

You could try OCaml (it does have exception but they're usually "opt in"), it's a really nice language and probably one of the closest to GC'd Rust. There's also Swift that inspired some features.

OCaml is often dropped due to its unpredictable performance

Re: Lang Jam: create a programming language in a weekend

#57
post #48

As someone that writes a lot in Rust, I have a longstanding dream to make a compiler for a subset of the language, since I don’t use all features of Rust and my hope is that this way I could have fast debug builds (in terms of compilation time) while I develop, with simplified borrow checker and so on. So then I can iterate faster. That’s one of my dreams. But I have not had time to even look at it yet, as the other…

I'd like a GC (no borrow checker) version of Rust. There's so many cool concepts in the language that I'd like to know how useful it is in different contexts. (Compiled without a VM, option types, no nulls, easy error handling without exceptions...)

I think a scripting version of rust with a GC and gradual typing would be really nice. Especially one that allows incrementally converting a script into a compiled rust program.

Re: Lang Jam: create a programming language in a weekend

#58
post #29
post #23

What kind of language ideas do you folks have? What would your fizzbuzz look like? I'm not sure I've ever seen a more readable compact fizzbuzz than this version in coffeescript ['fizz' unless i%3] + ['buzz' unless i%5] or i for i in [1..100]

I'd like a language that makes it easy to mock and dependency inject without doing anything special. IE, if in my business logic, I write "new Foo()", I'd like to be able to write a unit test where I say something like, "whenever I wrote 'new Foo()' swap in this mock object instead." Or, in a module that's an entry-point, I'd like to say, "whenever I wrote 'new Foo()' swap in this subclass instead." I've spent so muc…

Take a look at newspeak (smalltalk-ish, it avoids global references enforcing each component to receive dependencies as arguments, i.e. it has DI builtin) and NesC (C with components, which are composed at build time).

Neither is popular but they're pretty interesting!

Re: Lang Jam: create a programming language in a weekend

#59
post #50

Earlier quoted context omitted.

You could try OCaml (it does have exception but they're usually "opt in"), it's a really nice language and probably one of the closest to GC'd Rust. There's also Swift that inspired some features.

OCaml is often dropped due to its unpredictable performance

I've heard the opposite about it, that its predictable performance is one of its strength. Do you have any sources?

Re: Lang Jam: create a programming language in a weekend

#60
post #50

Earlier quoted context omitted.

You could try OCaml (it does have exception but they're usually "opt in"), it's a really nice language and probably one of the closest to GC'd Rust. There's also Swift that inspired some features.

OCaml is often dropped due to its unpredictable performance

Interesting. I’ve actually seen OCaml being chosen because of its predictable performance. But that was by people coming from Haskell.
Post reply on HN