Kary
click on it...


Arendelle Coding Style

When I made Arendelle I had this idea to make it’s language beautiful in design and when I say that I’m not mentioning the advances in technology but the code’s look itself.

In its design, I applied a very simple concept that I care so much and it’s use of spaces. I’ve seen programmers who agree with me. For example in the 125th issue of ACCU’s Overload there’s an article called “I Like Whitespace” which is also available online here

I don’t agree with all other people’s ideas and for example, I like the idea of CamelCase and camelBack naming styles and till this day, I always hated underlines in names. So I will explain to you how to code in my style with Arendelle however as every documentation of Arendelle till this day is written by me only way you may know of Arendelle codes are most probably my way however I would like ver much to once and for all explain how my style and notation works (Have in mind that this Arendelle’s original way of coding is what I show you here)



Let’s start from basics

First thing you write in Arendelle is commands and we write commands with no space like this

prpldp

However sometime we separate this command with spaces like this:

prp ld prp

This kind of spacings gives prp and ld some kind of identity which is very good when you’re going to read the codes. No, when it comes to comments you may wonder how to space? In the other languages you do something like this which is really not cool:

// allocating and initializing a string
NSString * str = [[NSString alloc] initWithString:@"Hello, World"];

In the time many people showed that // is not really pretty so they did this:

//
// Allocating and initializing a string
//

NSString * str = [[NSString alloc] initWithString:@"Hello, World"];

In many Markdown editors like iA Writer and UberWriter you see this kind of highlighting:



Which when you use # header operator it actually puts it out of the screen. I wanted such thing in the Arendelle so I comment like this:

// When you write comments things that are
// for the comment will come in 3 spaces so the
// like it’s part of the text’s content not '// '
   [ 10 , pr ]

This way you give the // kind of a new life and a new look. Then what come to the mind is nested comments which are like vise:

// level one comment
   [ 10 , pr ]

   // level two comment
        [ 20 , pr ]

      // level three comment
         [ 10 , pr ]
         [ 10 , pd ]

   // back to level two
      [ 10 , pr ]

// done



Writing Grammars

In Arendelle all the grammars are same in design. All of the start with something and then you separate the parts using , and then they finish with something like:

[ , ]  { , }  < , >  ( , )

And the format for highlighting this codes are simple. You should do this:



So I think I don’t have to guide you any more on this! Write things like:

[ 10 , pr ] ll [ 20 , pr ]



Mathematical Expressions

I believe if we write mathematical expressions with a space between all the operators like:

@space + 10 / 2

Now the thing that comes to mind is parentheses. Apply the same principles on them as what we did before:

( #i + 2 ) / 5

You see how more clear they looks? You can also use them like:

( ( #i / 2 ) + 4 )

Speaking of parentheses when you use inline string replacers like:

'Inline string interpolation: | @space |'

Use a space before and after the math expression like:

'half of space is | @space / 2 |'



Names

In Arendelle you can give Spaces, Stored Spaces and Functions names. naming this things are more often a very simple task like:

( size , 10 )

Space names are lowercase (a-z not A-Z) very simple. However, the problem starts when you have more than one word for the name like

( aLongName , 10 )

Like many implementations of FORTRAN, Arendelle removes all the new lines, spaces and tabs except the ones in strings prior to compile. So it really doesn’t matter if you use spaces in the names

( age of kary , 19 )

Is acceptable and well you can use it likewise as:

[ @age of kary , 19 ]

As well as using

[ @ageOfKary , 19 ]

Thanks to these @, #, !, $ Arendelle won’t read the name wrong so there are some very common popular rules in space naming like CamelCase, camelBack and using_underscore_as_whitespace like

ageOfKary   // camelBack
AgeOfKary   // CamelCase
age_of_kary // underscores

But when you can use spaces in Arendelle why not? You can do:

( age of kary , 19 ) [ @age of kary , pr ]

When it comes to !, @, $, # and . for directory addressing use them like this:

( $stored space , 10 ) [ @space name , pr ] 
[ $use .of .stored space , pr ]

If you’re a developer like me this kind of naming may look a bit strange and confusing to you. I know at first it’s unacceptable but as soon as you warm up to it, It becomes a more readable way to read and write codes.

And if you didn’t well you’re still free to do whatever you want!



Functions

I very much like to write function names like this:

!func name ()

And also function address:

!folder .func () /* or */ !folder.func ()

Now when you’re making libraries do this kind of coding style. I like it very much:

!math. floor ()

And sometimes:

!math.array. floor ()

Also something that is very important about functions is their special comments. To use function comments use this way:

!func ( init with number: 12, and number: 5 )

Write them lowercase and don’t forgot the space after ( and ,. So like the example, I showed you!



Multi Line Comments

Use the C way, However after stating asterisks use 3 spaces, Something like this:

/*
 *   A multi line
 *   comment must be something
 *   very much like this
 */

But hey I hate this multi-line comments! I have them in Arendelle because well they are C style and sometimes they are handy but when it comes tot he multi-line comments use this system:

//
// A multi-line
// comment must be something
// very much like this
//

As you see it’s a much more beautiful way to write comments, I use them most of the times for section flags like:

//
// BODY
//

   [ 10 , pr ]

//
// DONE
//



Arrays

It’s better if you init multi member arrays like this:

( array , 12; 23; 34; 454; 232 )

And please no:

(array,23; 23;34; 23;2122)

Also when you want to load an array index use this way:

@array[ @index ]

Also for nested ones use:

@array[ @nested array[ @also nested array[ @index ] ] ]



Nested grammars.

As I said before use 3 space tabs and this style:

( line , 0 )

[ #j,

    i [ @line , d ] 
    ( line , +1 )
    { #x < #y , p } r

]

I think that was a good enough example!




That’s it!

I hope you like my style of coding. This is the actual way that Arendelle is made for and I hope you use it too. A part of my style is using First Spacings, Standard Copyright and Done comment which is explained in the Arendelle Book. So I hope you use them too. Also, gimme your suggestions on how to make this style better.

Top of Stack!