Live data from Hacker News

Lang Jam: create a programming language in a weekend

github.com

111–120 of 135 posts

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

#111
post #110
post #101

Earlier quoted context omitted.

> we genuinely can only laugh at people That's perhaps not the best wording. Nonetheless, I do agree with you. D can be very flexible in that regard.

I don't know how else to word it. Every thread about D has people going on and on and on and on about the GC, and they aren't always wrong (there is always good information here) but fundamentally it doesn't matter . Many D programmers come from PHP rather than C++ - D isn't attractive to them because of systems programming but rather high level programming e.g. metaprogramming.

[deleted]

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

#112
post #63

Earlier quoted context omitted.

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…

I think 0 should be a FizzBuzz? Also I'm not sure how that solution would work for negative numbers... Then again what is the right answer for 7i + 24? Corner cases duck!

For 0 being a FizzBuzz you can `cons` a "FizzBuzz" to the start of the list

  fizzbuzz = "FizzBuzz" : zipWith...
To make negative numbers work you'd need a new numbers definition

  numbers = map show [-1, -2..]
Should yield all the negative integers eventually.

I've never heard of FizzBuzz defined for complex/imaginary/2-d numbers. That's interesting to consider, I'll be thinking about this for a while

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

#113
post #59

Earlier quoted context omitted.

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

Darklang is being rewritten in .Net Flowtype has horrible performance, which in my opinion partially explains why it has lost so many users to Typescript, which has much more predicable and fast performance even though it's written in JS. The project is basically dead

I've never used neither Flow nor TypeScript, but there's an essential difference between the two - Flow is type inference engine, whereas TypeScript is a type checking engine. The latter is a fundamentally a much simpler problem (both semantically, and algorithmically) than the former. In addition, Flow picks a particularly nasty niche for type inference - OCaml itself uses type inference, it's fast (with quadratic blowup in edge cases) because OCaml's types are simple, whereas Flow IIRC tries to support both subtyping and some of JS's dynamicity, so I'm not surprised if it's slower.

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

#114
post #100

Earlier quoted context omitted.

Whether or not Swift succeeds at being memory-safe, in theory, it's supposed to be.

It's memory-safe in a single-threaded context. The actor model would theoretically bring multi-threaded memory safety (with a different set of tradeoffs than Rust).

Thanks for clarifying.

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

#115
post #110
post #101

Earlier quoted context omitted.

> we genuinely can only laugh at people That's perhaps not the best wording. Nonetheless, I do agree with you. D can be very flexible in that regard.

I don't know how else to word it. Every thread about D has people going on and on and on and on about the GC, and they aren't always wrong (there is always good information here) but fundamentally it doesn't matter . Many D programmers come from PHP rather than C++ - D isn't attractive to them because of systems programming but rather high level programming e.g. metaprogramming.

There seems to be at least one reason to have a non-GC option: You want to write code that integrates with an environment that already has its own GC and you want that to decide things. For example you want to integrate existing libraries in C/C++/D/Go/Rust/whatever with a Lisp process, since there's lots of those libraries and they do useful things, and you don't have a Lisp library for that (yet). In that case having one point of deciding when to deallocate things seems to be better than having two of them.

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

#117
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…

Python already has everything you need. The most important aspect is that you don't have to change your code to use it.

https://docs.python.org/3/library/unittest.mock.html

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

#118
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 think there's a lot of opportunity in the 2d domain, in both directions.

You might have a picture represent a program, like Piet [1]. Or you might have a language specifically designed to show certain types of pictures, like TeX or Processing or more narrowly, PlantUML.

Another area to explore is the distributed space. Perhaps a language with Kubernetes capabilities as first-class objects.

1. https://www.dangermouse.net/esoteric/piet.html

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

#119

I could use something similar to jq, but for XML. Or something like a lovechild of sed, awk, seq, and cut, with regexp match groups and string interpolation.

> I could use something similar to jq, but for XML.

That would be XPath/XQuery

I have spent 15 years implementing that in Xidel

>Or something like a lovechild of sed, awk, seq, and cut, with regexp match groups and string interpolation.

Sounds like Perl

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

#120
post #16
post #13

Earlier quoted context omitted.

Or a Lisp and let the user face them instead.

Forth seems easier to do over a weekend, though.

Definitely easier; it has no structure at all, it's all in your head/stack.

https://github.com/codr7/fipl

Post reply on HN