Main Menu

CRPL feature request

Started by Annonymus, January 06, 2014, 08:56:33 AM

Previous topic - Next topic

Annonymus

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
<-creeperG 20 lte <-creeperR <-creeperG gte Or <-creeperB <-creeperG gt and if
I'd like to see something like
[[<-creeperG 20 lte <-creeperR <-creeperG gte Or] <-creeperB <-creeperG gt and] if
or
[[[<-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
<-creeperG 20 lte or (<-creeperR <-creeperG gte) and (<-creeperB <-creeperG gt) if
and someone else may have used
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.
If a topic started by me is in the wrong place feel free to move it at anytime.

Michionlion

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

#2
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?
If a topic started by me is in the wrong place feel free to move it at anytime.

Michionlion

#3
[ code=title of codeness!] or [ spoiler=titlehere].  The title is a direct attribute of the tag.
"Remember kids, the only difference between science and messing around is writing it down."
                                                                                                                         - Adam Savage

My website
My CW1, and CW2 maps!

Clean0nion

Getting back on topic, this is actually a nice idea that I support. Not sure how easy it is to implement, though.

Annonymus

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

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:

<-creeperG 20 lte <-creeperR <-creeperG gte Or <-creeperB <-creeperG gt and if

becomes this without much effort:

<-creeperG 20 lte
<-creeperR <-creeperG gte
Or
<-creeperB <-creeperG gt
and
if