fubark / cyber

Fast and concurrent scripting.
https://cyberscript.dev
MIT License
1.16k stars 38 forks source link

RFC: Replace CYON with JSON5 #78

Open VisenDev opened 7 months ago

VisenDev commented 7 months ago

Hello, I'd like to request information on why Cyber Object Notation was chosen as the serialization/deserialization format for this language.

As it seems the syntax is quite similar to JSON5, i'd like to discuss whether it would be better to use this more widely supported language instead.

This example in CYON

[
    name: 'John Doe',
    'age': 25,
    -- This is a comment
    cities: [
        'New York',
        'San Francisco',
        'Tokyo',
    ],
]

Would look like this in JSON5

{
    name: 'John Doe',
    'age': 25,
    // This is a comment
    cities: [
        'New York',
        'San Francisco',
        'Tokyo',
    ],
}

As you can see, it allows for almost identical syntax. While having the benefit of being a more common format that will be more accessible. (For example, as show above, JSON5 is common enough that github has syntax highlighting for it)

This isn't meant to be a criticism of the design of CYON, or say anything about whether its syntax is good or bad.

fubark commented 7 months ago

Right now they are similar but having our own format allows us to extend it further later on.

I'm not against supporting JSON5 though. Ideally it would be a third-party package that you can just import from a URL but since Cyber is in its infancy it could simply go into a builtin "x" module like in Golang. Essentially a temporary module for useful utilities that early adopters might find convenient.