Why is `pure` a keyword that needs to be added, with impure being the default? This discourages programmers from marking functions as pure. I like how Nim does it, with `func` declaring a function (pure) and `proc` declaring a procedure (impure).
> Why is `pure` a keyword that needs to be added, with impure being the default? Marketing. Instead of reading the code littered with "impure" keywords, you look at the beautiful code marked as "pure".
Blorp Language
51–60 of 67 posts
Re: Blorp Language
#52I know there are people that are used to the indention based scope but that has a real problem when it comes to copy/pasting code. I think a alternative that still looks pretty clean is to do like Ruby and Julia and have the function/class imply begin and have a literal 'end'.
I don't understand this concern. How exactly are you copy/pasting code such that significant indentation causes "real problems"? I remember the creators of Go explained [1] that they chose explicit block delimiters because of problems they saw when embedding snippets of Python in other languages. But this seems like a very niche kind of problem. [1]: https://go.dev/talks/2012/splash.article#:~:text=we%20have%2...
Re: Blorp Language
#53Almost all "new" languages presented on HN are basically slightly different flavours of languages that have been around for a very long time. But without the libraries/documentation/tools etc. needed to make it useful.
Re: Blorp Language
#54Why is `pure` a keyword that needs to be added, with impure being the default? This discourages programmers from marking functions as pure. I like how Nim does it, with `func` declaring a function (pure) and `proc` declaring a procedure (impure).
> Why is `pure` a keyword that needs to be added, with impure being the default? Marketing. Instead of reading the code littered with "impure" keywords, you look at the beautiful code marked as "pure".
Re: Blorp Language
#55Earlier quoted context omitted.
That's more of a compiler limitation that became cultural for a while. Most languages (both natural and artificial) use delimited structures sparingly and rely more on other cues. It sometimes appears spontaneously (e.g. "∫ dx f(x)" is logically fine, but feels wrong) but in general it's rare. The move away from indentation in programing came as a rebellion against the too-constraining fixed column languages, in the…
In my experience there are many problems with significant whitespaces, things like copying pieces of code require much more work, when indentation actually changes the logic you can not ask your tool to do it automatically - because there is no single right way to do it. Tabs vs spaces can also be a problem.
IME, it requires less work. You just grab the piece of code you want, whereas with braces, you need to count which closing brace is the correct one.
Re: Blorp Language
#56It would be nice to see a "new" language that actually does something truly new and valuable. Almost all "new" languages presented on HN are basically slightly different flavours of languages that have been around for a very long time. But without the libraries/documentation/tools etc. needed to make it useful.
Re: Blorp Language
#57Why is `pure` a keyword that needs to be added, with impure being the default? This discourages programmers from marking functions as pure. I like how Nim does it, with `func` declaring a function (pure) and `proc` declaring a procedure (impure).
But there can be many (small) applications where pure doesn't even matter, so I don't really want to force someone to write "impure" for the main function, for example.
Re: Blorp Language
#58"Blorp" is the notional noise of kimchi or sauerkraut fermenting as the carbon dioxide escapes the airlock. Vigorous fermentation can be described as "the kimchi is really blorping along today". It's almost onomatopoetic, but not quite. We ferment wine or beer in a different vessel with different airlock, so it does not blorp. We don't have a word for that yet. The crock we used that birthed this word is this one: ht…
Re: Blorp Language
#59Why is `pure` a keyword that needs to be added, with impure being the default? This discourages programmers from marking functions as pure. I like how Nim does it, with `func` declaring a function (pure) and `proc` declaring a procedure (impure).
Roc defaults functions to being pure, and functions that can run side effects are inferred to have a different type by the compiler based on usage. By convention, their names should also end in `!` (e.g. `transform` for the name of a pure function and `transform!` if it does side effects), and the compiler warns you if you don't follow that convention. https://github.com/roc-lang/roc/blob/b2503210da6b58a4ce1254d...
Re: Blorp Language
#60Interesting. there are some parts i like a lot here, but two things that I really dislike syntax wise. One is the lean towards a chainable syntax - this has proven to a big footgun for many devs in both java streams and typescript, making it very easy to go from O(n) to O(2n). The other part i really dislike is the first argument principle noted. If i myself define `string_and_reverse` and I can call it both through…
Of course, blorp also allows local mutation in loops (even in pure functions, so long as the logic is contained to the function), so if there's a specific algorithm you'd rather express in a loop, you can.