3 ms·
> there are a few minor things i'd probably have done differently, but on the whole i find pyret code very pleasant to read. Curious to know what would you hav
by a0 10y ago
> there are a few minor things i'd probably have done differently, but on the whole i find pyret code very pleasant to read.
Curious to know what would you have done differently. I'm working on a programming language based on OCaml with Ruby-like syntax.
- zem 10y agojust bikesheddy stuff like * |> rather than ^ for the pipe operator (more consistent with several other languages) * [list| 1, 2, 3] rather than [list: 1, 2, 3] (just for better visual distinction, though the current syntax does look pretty clean and uncluttered) * having a separate code block for methods of individual variants rather than interspersing them with data definitions (because i think it's important that the basic data definition be as uncluttered as possible) if you'd like some syntax feedback on your language i'd be happy to take a peek :)
- skrishnamurthi 10y agoI'd disagree with the second one. `[list: 1, 2, 3]` reads more like in English: "I'm going to define a list: one, two, three…". Whereas `[list| 1, 2, 3]` has no obvious vocalization. (Vocalization is an important characteristic for us; it's how `ask` came to have its syntax.) In addition, we usually use `|` in programming languages in a separator kind of way (even `||` for "or" separates expressions), which it's certainly not in the list expression.
- zem 10y ago"list where the elements are 1, 2, 3", by analogy with set builder notation or list comprehensions :) but i agree the current one reads better as english. it's the separator aspect i was getting at with my proposal though - visually it's [ datatype | elements ] whereas the current one looks more like the colon is part of the first element - [(list : 1), 2, 3]
- skrishnamurthi 10y agoNot once you learn to vocalize it, the way I just showed you how (-:. Frankly, I'm really trying, and I'm having a very hard time suffering from the "list: 1" confusion you claim. I admit, that's just me. Also, `|` as a separator suggests a kind of symmetry. But the two sides are not symmetric at all. Whereas in English, `:` does not imply symmetry.