Stream: ideas

Topic: ✔ Start move to PNC before we are ready for Static Dispatch?


view this post on Zulip Anthony Bullard (Dec 26 2024 at 17:01):

Should we go ahead and create an issue for moving from whitespace application to Parens and Commas application syntax (PNC)? And land it ahead of Static Dispatch?

view this post on Zulip Anthony Bullard (Dec 26 2024 at 17:02):

This is work I'm _very_ interested in tackling, so if we have consensus, I can begin in earnest over the next wekk

view this post on Zulip Sam Mohr (Dec 26 2024 at 17:03):

I think it's basically orthogonal to static dispatch, so that sounds good to me. We'll need to support spaces and parens to start with.

view this post on Zulip Anthony Bullard (Dec 26 2024 at 17:04):

Sam Mohr said:

We'll need to support spaces and parens to start with.

That's gonna get messy pretty quick, but we can explore. We might have to have a "PNC" detector pre-parse phase or something to put the parser into PNC mode

view this post on Zulip Anthony Bullard (Dec 26 2024 at 17:04):

And then have a MIgrationFlag to move WSA(Whitespace application) to PNC

view this post on Zulip Anthony Bullard (Dec 26 2024 at 17:05):

I don't think for a single file we want a mix of WSA and PNC

view this post on Zulip Georges Boris (Dec 26 2024 at 17:07):

What is PNC? :sweat_smile:

view this post on Zulip Anthony Bullard (Dec 26 2024 at 17:09):

Georges Boris said:

What is PNC? :sweat_smile:

Sorry, added clarification in the first message

view this post on Zulip Sam Mohr (Dec 26 2024 at 17:22):

Anthony Bullard said:

I don't think for a single file we want a mix of WSA and PNC

We've had good success with doing Tasks or Purity Inference based on the start of the file, and I agree there should be no need for both parens and space application in the same file

view this post on Zulip Joshua Warner (Dec 26 2024 at 17:30):

For the most part, I don't think PNC conflicts with space-based calling

view this post on Zulip Joshua Warner (Dec 26 2024 at 17:31):

If we can avoid having two different modes for the parser, that sounds preferable to me

view this post on Zulip Joshua Warner (Dec 26 2024 at 17:32):

To expand on that a bit, in order to support both of these cleanly, we need to be a little bit picky about whitespace around parens (at least temporarily)

view this post on Zulip Joshua Warner (Dec 26 2024 at 17:33):

a(1, 2, 3) is a PNC function call with three args, and a (1, 2, 3) is a space-style function call with one arg (that just happens to be a tuple).

view this post on Zulip Richard Feldman (Dec 26 2024 at 17:47):

yeah it's very helpful if they can coexist for some period of time because it means the formatter can convert from one to the other

view this post on Zulip Anthony Bullard (Dec 26 2024 at 17:49):

Sounds good. I’ve always thought that a space between function name and the args (gnu style) is a thought crime

view this post on Zulip Richard Feldman (Dec 26 2024 at 17:52):

I had no idea anyone used that style in C land

view this post on Zulip Anthony Bullard (Dec 26 2024 at 18:15):

Read this if you want to cry/vomit: https://www.gnu.org/prep/standards/html_node/Syntactic-Conventions.html#Syntactic-Conventions

view this post on Zulip Anthony Bullard (Dec 26 2024 at 18:40):

Sounds like there are no dissenters to creating the issue. Will do that now

view this post on Zulip Anthony Bullard (Dec 26 2024 at 18:52):

(deleted)

view this post on Zulip Anthony Bullard (Dec 26 2024 at 18:52):

https://github.com/roc-lang/roc/issues/7415

view this post on Zulip Notification Bot (Dec 26 2024 at 18:53):

Anthony Bullard has marked this topic as resolved.

view this post on Zulip Eelco Hoekema (Dec 29 2024 at 20:11):

As an outsider, i would say the white space is a unique selling point of Roc. I understand it may not matter much in structure, but syntax matters too. Conciseness of the code does not necessarily make it more readable, on the contrary. To me it looks similar to how ReasonML tried to make JavaScript out of OCaml, making it Just Another Programming Language.

view this post on Zulip Anthony Bullard (Dec 29 2024 at 21:05):

ReasonML has largely failed for many other reasons - mostly that the OCaml/ReasonML/REScript tooling and story was complicated and hard to navigate. Not to mention a couple different competing standard libraries, and too much focus on winning over React devs.

view this post on Zulip Anthony Bullard (Dec 29 2024 at 21:05):

I personally can say ReasonML is the first time most people I know every looked at a ML-family language seriously

view this post on Zulip Anthony Bullard (Dec 29 2024 at 21:07):

Syntax does matter, but many people just don't like syntaxes that feel "weird" to them. See Elixir over Erlang as one example, or Java/Kotlin/Scala all being much more used than Clojure despite Clojure being a _very_ good language.

view this post on Zulip Eelco Hoekema (Dec 29 2024 at 21:40):

Then again, for those who do like the weird Clojure syntax, it is a blessing there is a language for them. There are many c-like languages out there. Roc becoming one of them will make it less significant. Roc as that one ML syntax based language that got it right would have.

view this post on Zulip Anthony Bullard (Dec 29 2024 at 21:51):

I think the significance of a language is in the semantics, but I won’t speak for Richard here

view this post on Zulip Richard Feldman (Dec 29 2024 at 21:57):

Eelco Hoekema said:

There are many c-like languages out there. Roc becoming one of them will make it less significant. Roc as that one ML syntax based language that got it right would have.

the goal is to make Roc a great language for making delightful software, not to score points on the language syntax scoreboard :big_smile:

view this post on Zulip Richard Feldman (Dec 29 2024 at 21:58):

I think it's totally fair to prefer one syntax over another - everyone has preferences, myself included! - but I think "Roc should have whitespace calling because that's not mainstream and Roc should help make it mainstream" would be the wrong reason to make that syntax decision

view this post on Zulip Eelco Hoekema (Dec 29 2024 at 22:07):

That is a bit ridiculising it. My fear is the opposite, that with this change Roc trades delight for mainstreamness. Which, i think, would be a terrible reason to make a syntax decision. It is disappointing, but then again, i am an outsider, it is your language.

view this post on Zulip Brendan Hansknecht (Dec 30 2024 at 03:12):

If you read a lot of the initial discussion, this is trying to unlock a new form of delightfulness. One direct example is that you get . completion with chaining. That is much more delightful than pipelining qualified functions when making a chain of transformation. While space calling convention is awesome for DSL, it can often fall short for regular code.

view this post on Zulip Brendan Hansknecht (Dec 30 2024 at 03:14):

This design is not chasing mainstreamness. It can be maybe seen as a nice side effect that it is more mainstream, but the focus is on improving roc capabilities and tooling.

view this post on Zulip Brendan Hansknecht (Dec 30 2024 at 03:17):

Personally, I have thought about this a lot, and was originally quite against this. Space calling convention was one of the pieces of roc that made it unique and special to me. It definitely is a large part of the feel of roc. Kinda feels like part of the heart of roc to me. At the same time, after a while of thought and discussion, I think this is the right way for roc to go. dot calling convention enables better tooling and readability in a number of very common cases.

view this post on Zulip Eelco Hoekema (Dec 30 2024 at 17:42):

Got it, thanks. It is a tradeoff, valuing writeability over code clarity. Still makes me sad.


Last updated: Jun 16 2026 at 16:19 UTC