CRPL feature request

Annonymus · 1042

Annonymus

  • Jr. Member
  • **
    • Posts: 91
on: January 06, 2014, 08:56:33 am
I'm posting this here because I saw similar topics being moved here, but if it's inappropriate, feel free to move it to the coders corner or whereever it belongs to.

I especially when reading other users code I miss to have parenthesis that do not influence the code, for example instead of
Code: [Select]
<-creeperG 20 lte <-creeperR <-creeperG gte Or <-creeperB <-creeperG gt and ifI'd like to see something like
Code: [Select]
[[<-creeperG 20 lte <-creeperR <-creeperG gte Or] <-creeperB <-creeperG gt and] ifor
Code: [Select]
[[[<-creeperG 20 lte] [<-creeperR <-creeperG gte] Or] [<-creeperB <-creeperG gt] and] if
This could make code very much better understandable, since especially with the warp notation everyone writes CRPL in a different way, for example I would have used
Code: [Select]
<-creeperG 20 lte or (<-creeperR <-creeperG gte) and (<-creeperB <-creeperG gt) ifand someone else may have used
Code: [Select]
if (and(or(<-creeperG lte (20) <-creeperR gte (<-creeperG)) <-creeperB gt (<-creeperG)))I could go on infinitely with examples of how others may write the exact same bit of code, so if you (virgil) could add something (I think the best solution would be [ and ] (please not { and } because some keyboards (including mine (I used alt+123 and alt+125 to make them)) don't have them)) that does not influence the code in any way but would still be saved to make the code more understandable for both the writer and the reader I would be happy.
« Last Edit: January 06, 2014, 10:33:21 am by Annonymus »

If a topic started by me is in the wrong place feel free to move it at anytime.


Michionlion

  • Sr. Member
  • ****
    • Posts: 1933
  • The Reclaimer
Reply #1 on: January 06, 2014, 09:42:34 am
Just a tip to make your post more readable: use [code ][/code ]
Code: (title of codeness!) [Select]
code tags.

"Remember kids, the only difference between science and messing around is writing it down."
                                                                                                                         - Adam Savage

My website
My CW1, and CW2 maps!


Annonymus

  • Jr. Member
  • **
    • Posts: 91
Reply #2 on: January 06, 2014, 10:32:33 am
I know how to do it, but I wasn't sure if it's appropriate because I would have to use it so much...
edit: how do you make that title (Code: (title of codeness!))? and how can i make it on spoilers?
« Last Edit: January 06, 2014, 10:34:33 am by Annonymus »

If a topic started by me is in the wrong place feel free to move it at anytime.


Michionlion

  • Sr. Member
  • ****
    • Posts: 1933
  • The Reclaimer
Reply #3 on: January 06, 2014, 11:02:38 am
[ code=title of codeness!] or [ spoiler=titlehere].  The title is a direct attribute of the tag.
« Last Edit: January 06, 2014, 11:04:29 am by Michionlion »

"Remember kids, the only difference between science and messing around is writing it down."
                                                                                                                         - Adam Savage

My website
My CW1, and CW2 maps!


Clean0nion

  • Guest
Reply #4 on: January 06, 2014, 11:15:55 am
Getting back on topic, this is actually a nice idea that I support. Not sure how easy it is to implement, though.



Annonymus

  • Jr. Member
  • **
    • Posts: 91
Reply #5 on: January 06, 2014, 12:39:47 pm
I think it shouldn't be hard, it's like the comments, but it ends after 1 sign...
Or maybe it's even easier as just not specifiing anithing for [ and ] and tell the compiler to not give an error message when there are some...
Of course I'm just guessing, it could also be hard as hell to implement for various reasons (for example because there is no other programming language making something like this and thus there is no example from where virgil could learn how to make it)

If a topic started by me is in the wrong place feel free to move it at anytime.


knucracker

  • Administrator
  • *****
    • Posts: 11749
Reply #6 on: January 06, 2014, 01:01:12 pm
I don't want to use brackets, since I may one day add static list declaration support.  If I do, then "[1,2,3] ->list" would create a list initialized with three integers.
But let's explore the usefulness/necessity of the idea.

First, it would be a voluntary syntax.  So you would not often find it in scripts.  It would depend on the author.  Second, you can accomplish a very similar thing using Warp syntax.  So if the goal is to make more readable syntax, then the author can already accomplish that... it just may be that the author chooses not to.

Now another use case is a secondary author wants to modify some source he didn't write to make it more readable for himself.  Say that you take a script from someone else and want to make it more readable.  In this case you can change it to the warp syntax that you prefer (using full prefix and infix notation for instance).  If that's too much typing, you can use new lines to help out instead of brackets.

This:
Code: [Select]
<-creeperG 20 lte <-creeperR <-creeperG gte Or <-creeperB <-creeperG gt and ifbecomes this without much effort:
Code: [Select]
<-creeperG 20 lte
<-creeperR <-creeperG gte
Or
<-creeperB <-creeperG gt
and
if