Content deleted Content added
No edit summary |
→Syntax: grammatical number; notation |
||
(36 intermediate revisions by 13 users not shown) | |||
Line 1:
{{short description|Programming language}}
{{Multiple issues|{{primary sources|date=August 2020}}{{
{{Infobox programming language
| name = Citrine
Line 8:
| designer = Gabor de Mooij, Aavesh Jilani
| developer = Gabor de Mooij, Aavesh Jilani
| latest release version = 0.9.
| latest release date = {{Start date and age|
| typing = [[dynamic typing|dynamic]]
| implementations = C
| influenced by = [[Smalltalk]], [[Self (programming language)|Self]]
| influenced =
| operating system = [[Cross-platform|Cross-platform (multi-platform)]]
| license = [[BSD licenses|BSD]]
| website = {{URL|citrine-lang.org}}
| file ext = .ctr
}}
'''Citrine''' is a general-purpose [[programming language]] for [[Cross-platform|
==Syntax==
Citrine has a very limited syntax
* {{code|Nil}}
Line 33:
* <code>{ ...params.. ...block of code... }</code>
The code block literal uses a ''pipe'' symbol ⟨|⟩ to separate the parameters from the logic
parameters, the backslash should be used instead
Citrine only supports full-line comments,
A Citrine program is basically a sequence of messages sent to objects. For instance, to determine whether 5 is an even number, the message 'even?' is sent to the number 5.
Line 44:
</syntaxhighlight>
This is called a ''unary'' message, because it takes no arguments. A ''binary'' message is always a single UTF-8 character; this differs from Smalltalk, where there is a fixed set of binary messages. Here is an example:
<syntaxhighlight lang="smalltalk">
Line 50:
</syntaxhighlight>
Here a binary message '+' is sent to number 6, with the argument of
<syntaxhighlight lang="smalltalk">
Line 56:
</syntaxhighlight>
<syntaxhighlight lang="smalltalk">
Line 74:
<syntaxhighlight lang="smalltalk">
{ :step ✎ write: 'this is step:' + step. }
</syntaxhighlight>
To break out of a loop in Citrine, one
▲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:
<syntaxhighlight lang="smalltalk">
Line 88 ⟶ 87:
==Pipelines==
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,
<syntaxhighlight lang="smalltalk">
Line 95 ⟶ 94:
==Prototypes==
The biggest difference from Smalltalk is the use of prototypes. Citrine does not have a concept of a class,
<syntaxhighlight lang="smalltalk">
Line 101 ⟶ 100:
</syntaxhighlight>
This object can be made to respond to messages by ordering the object to listen to events
<syntaxhighlight lang="smalltalk">
Line 132 ⟶ 130:
</syntaxhighlight>
returns the length of the string in UTF-8 code
<syntaxhighlight lang="smalltalk">
Line 160 ⟶ 158:
* [https://www.reddit.com/r/programming/comments/42gqu4/new_programming_language_citrine/ Announcement on Reddit]
* [http://www.infoworld.com/article/3028559/application-development/citrine-borrows-from-ruby-javascript-c-for-object-oriented-programming.html InfoWorld interview]
* [https://web.archive.org/web/20221108082728/https://www.tiobe.com/tiobe-index/ Tiobe Index]
==External links==
* {{Official website|citrine-lang.org}}
* [https://github.com/gabordemooij/citrine source code], Source code on
<!--Interwikies-->
<!--Categories-->
[[Category:Smalltalk programming language family]]
[[Category:Procedural programming languages]] |