What a pity ooc use blank as separator: would it be possible to create a fork using a dot

Skip to first unread message


Nov 4, 2016, 5:42:47 AM11/4/16
to ooc-lang

I really like the ooc philosophy BUT for me the only problem is the syntax because it's really disturbing to not put some separator between a method and an object.
I mean if I look at the first page I can see the following code:

parse: func {
PropReader new(path, props)

// parse deps
requires := props get("Requires")
if (requires) {
deps addAll(requires split(',', false) map (|dep| dep trim(" \t")))

If you really want to claim that the language is inspired by C family it should be written like that:

parse: func {
PropReader.new(path, props)

// parse deps
requires := props.get("Requires")
if (requires) {
deps.addAll(requires.split(',', false).map(|dep| dep.trim(" \t")))

I mean it's impossible for me to get used to the current syntax while I feel comfortable with the second one.
And I am 200% sure that if this language is not more widespread it's because of this very annoying syntax. Even Objective C use [] to separate method calls...
I would be curious to know if it would be difficult to create a fork of this language that use a dot for separator ?

Jeremy Clarke

Nov 5, 2016, 5:45:14 AM11/5/16
to v.ric...@gmail.com, ooc-lang

Hey! I can't really comment on the feasibility of making such a fork, it may be a case of swapping out some tokens in the lexer/parser but also every source file in the compiler and standard library would have to be modified to use the new syntax. But hear me out - I don't think this is something that should be done.

First off, creating such a major fork would be bad because now people have to choose which flavour of the language they want to use, and potentially have two copies of every library in the case that they want to support both. It would be more severe than python 2.6/3 or lua 5.1(jit)/5.2/5.3

(ok, we kind of have this issue with ooc-lang / magic-lang, but they have the same syntax so I believe it's possible to write code that works in both)

'.' is already used in the language for method chaining on a single object e.g.

myObj foo() .bar() .baz()

Which is a neat idea as it saves you from having to 'return this' at the end of every function.

While the language is C-like, it does deviate from the norms here and there, and I think that's great, it's one of the things I love about it. Besides whitespace for member access, other examples would be @ for dereferencing, and the Ruby-inspired syntactic sugar of using |x| ... for anonymous functions.

Accidentally writing obj.foo() is a common mistake, I can't deny that, but I don't think it is a major thing that stops people from using the language. The syntax may be a little alien but I think if you spend some more time to get used to it, you could find it to be very pleasant and readable.

(I really like the language so sorry if I'm biased)


> --
> You received this message because you are subscribed to the Google Groups "ooc-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ooc-lang+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
0 new messages