























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... |
Hey - I'm the creator of Blorp, and like a lot of the ideas you have in Roc! Did you consider having opt-in purity? Or some other means of conveying impurity other than "!"? |
I also really like the distinction between a function and procedure. The function is a pure mathematical function. The procedure is a series of instructions. |
> 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". |
> copying pieces of code require much more work 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. |
No, significant whitespace today is still terrible, coming from Haskell, Python and Go (newlines that break expressions unreasonably) |
Apparently the truth hurts. I can't believe that the claim "python-style syntax is perfectly reasonable" deserves to be down-voted into the basement. |
The memory management model is automatic reference counting, with some optimizations, such as perseus for compile time reference counting where possible, and copy-on-write at runtime. |
"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: https://www.lehmans.com/product/striped-european-style-ferme... |
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... |
Scope being determined by indention makes it easier to paste things in the wrong scope and not notice. |
> making it very easy to go from O(n) to O(2n) Strictly speaking I assume everyone knows O(n) = O(2n) =O(kn) for k in R. But I see your point. I assume any decent compiler would merge the loops though |
Yes, blorp does that. And it also allows local mutation and loops inside pure functions, so performance doesn't need to be left on the table in most cases. |
To be fair this likely should be handled by the interpreter/compiler for the compiled JS. V8 probably can merge this into one loop or another similar based on runtime types |
Well, nesting is not the only option. ``` thing.doThis() thing.thenDoThat() thing.andFinallyThis() // or doThis(thing) thenDoThat(thing) andFinallyThis(thing) ``` |
The whole thing is 400k lines vibecoded over 3 weeks, I don't think there's been a lot of effort put into it yet. |
You might like this language I've been working on: https://GitHub.com/Cuzzo/clear It's not as true to Ruby as Crystal is, because I aim to make it far safer. It's closer to Elixir, if anything. But I love Ruby to death, and it is definitely the desire to make it as close to Ruby spiritually as possible. |
It looks nice. The general syntax isn't explained AFAICT? Looks somewhat Python-like but modernised (great!) - is it indentation sensitive? |
I like all those features! I was trying to find if it is definitely a significant whitespace syntax, as it appears to be |
> ergonomics of not having an early return I wonder who came up with this idea first. I find obvious early returns incredibly ergonomic. |
Wikipedia says that "guard clause" was a term invented by Kent Beck, but that the actual practice was used since at least the early 60s |
No, I meant the idea that guard clauses are antipatterns and your subroutine should have a single implicit return. |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。