Gravity code blocks

  1. 5 years ago

    Marc

    2 Feb 2019 User since 2018
    Edited 5 years ago by Marc

    Gravity is a nice language with nice additions like not, and, or and the ".." / "..." range operators. Also the optional semicolon is a great improvement.

    There's only one "but" ;).

    I hate the braces used for code blocks as used in C-like languages. For me that makes the code cluttered, especially when the code block doesn't fit on the screen. In that case you often see several close braces of which you don't know to which block they belong to.

    Because of that I would like to suggest an alternative block notation, as used in Basic like languages.

    Some examples:

    for (var i in 1..10)
       ....
    endfor I
    
    set
       ...
    endset
    get
       ...
    endget
    
    class x
        ...
    endclass x

    Or, if you believe this isn't suitable for Gravity, show some info (eg. in status bar) that shows in which code block the cursor is currently in.

    For example, if I'm in a for-loop code block, the info could show:

    for (var i in 1..10) ...

    So only the block definition, what would be enough to know.

  2. marco

    2 Feb 2019 Administrator User since 2016

    We'll surely improve the code editor with much more options (like code folding). Changing the design of the language at this point would be much harder.

  3. Marc

    2 Feb 2019 User since 2018

    @marco We'll surely improve the code editor with much more options (like code folding). Changing the design of the language at this point would be much harder.

    I understand that. I know this was a big thing to ask. Keep it in mind for times when you have nothing else to do ;).

    Maybe the "block info" feature is a bit easier to implement?

  4. marco

    2 Feb 2019 Administrator User since 2016

    Oh yes, the block info feature would be a lot easier!

or Sign Up to reply!