Content deleted Content added
Gabordemooij (talk | contribs) Added another reference. |
Jerryobject (talk | contribs) Add: Template:URL, Template:Official website. WP:LINKs: updates, WP:Disambiguates, WP:NOPIPEs fixed. WP:BADEMPHASIS MOS:BOLDs > WP:ITALICs or cut. MOS:CAPS > low-case. WP:EoS WP:COPYEDITs. |
||
Line 2:
| name = Citrine
| logo = Citrine programming language logo.png
| paradigm = [[
| year = 2014
| designer = Gabor de Mooij
| developer = Gabor de Mooij
| latest release version = 0.2
| latest release date = {{
| typing = [[dynamic typing|dynamic]]
| implementations = C
| influenced by = [[Smalltalk]] [[Self (programming language)|Self]]
| influenced =
| operating system = [[
| license = [[BSD licenses|BSD]]
| website =
| file ext = ctr
}}
'''Citrine''' is a general purpose [[programming language]] for
Readability is achieved by
features. Like Smalltalk,
of a class. In this regard, Citrine is more like
== Syntax ==
Citrine has a very limited syntax and it's very closely related to Smalltalk. Everything in Citrine is an ''
<source lang="citrine">
Line 36 ⟶ 35:
</source>
The code block literal uses a
parameters, the backslash should be used instead '\'.
Citrine only supports full line comments, comments start with a '#'.
Line 48 ⟶ 47:
</source>
This is called a
from Smalltalk, where there is a
<source lang="citrine">
Line 56 ⟶ 55:
Here a binary message '+' is send to number 6, the argument of this binary message is '7', this will result in a new number object '13'.
<source lang="citrine">
Line 62 ⟶ 61:
</source>
Also note that each line in a Citrine program ends with a dot, just like in Smalltalk. Besides unary and binary messages, Citrine
<source lang="citrine">
Line 69 ⟶ 68:
</source>
The code snippet above will return a boolean object
== Control
Just like Smalltalk, control flow in Citrine is implemented by strategic use of messages. For instance,
to a boolean.
Line 92 ⟶ 91:
</source>
To break out of a loop in Citrine one has to send the message 'break' to a boolean, this allows a conditional break from a loop without having to factor out the break conditions:
<source lang="citrine">
Line 106 ⟶ 104:
Unlike Smalltalk, Citrine has no semi-colon to send a message to the original receiver. Instead Citrine has a comma token ',' used
to chain keyword messages, this allows
to replace all the 'o' characters with zeroes, the resulting string would be something like: '1010101...'.
Line 122 ⟶ 120:
</source>
adding methods in languages like [[Java (programming language)|Java]]:
<source lang="citrine">
Line 131 ⟶ 129:
</source>
As
To derive an object from another object,
to be extended:
<source lang="citrine">
Line 150 ⟶ 148:
== Unicode ==
Citrine uses
of unicode symbols. All string length are calculated using UTF-8. Citrine distinguishes
string length and size in bytes:
Line 169 ⟶ 167:
Citrine uses [[dynamic scoping]] instead of [[lexical scoping]], this means there is no need
for [[
lexical scope. This is similar as in programming language like
[[EMACS Lisp]] and [[BASIC]]. In code blocks the
a local variable.
Line 184 ⟶ 182:
==See also==
* [[
==References==
Line 193 ⟶ 191:
==External links==
*
* [https://github.com/gabordemooij/citrine source code], Source code on github
|