Ѧ simple laחguagέ
ഽor ƩveЯyone

FAQ

Welcome to the Citrine FAQ page. Here you can find the more advanced topics regarding the Citrine programming language FAQ-style.

Why does Citrine use icons in the language?

Citrine makes use of the possibilities of UTF-8. Icons are more descriptive than abbreviations like 'var', they are quicker to type (once you configured your editor), language agnostic (can be used in Dutch source code as well) and allow more natural looking texts (in case of the thin space vs camelCase).

What's up with the languages?

Citrine can be compiled in different languages. This means the core messages can be English, Dutch, French or Icelandic. This allows Citrine to be used by a wider audience (i.e. schools). At time of writing, only English and Dutch versions are available. If you like to translate Citrine into your language, please contact me! While some language distributions are available on the download page, this site does not cover all different language versions (that would be too much work). The idea is that a Citrine ambassador will create and maintain a separate website for a language-specific distribution of Citrine.

Where can I find translation tables?

Here are the translation tables:

- Translation CSV English-Dutch (out-of-date, new version available soon!)

Can I fork Citrine?

Yes, find us on Github. Feel free to fork the source code on Github.

Can I use Citrine to teach programming?

Yes, because Citrine can be compiled in your native language. Citrine takes away language barriers and makes software development accessible to a wider audience. Citrine can also be tailored to suit the needs of a specific course and audience. Contact me for details!

What types of objects are there in Citrine?

There are 5 literal objects: Nil, Booleans (True,False), Numbers (i.e. 1,2,3.5,100 and so on), Strings (any text between 'single quotes') and code Blocks: { :parameter1 :parameter2 ...code... }. Every line ends with a dot (.). Assign a value to variable using :=.

What type of scoping does Citrine use?

Citrine uses dynamic scoping, for instance, the following example prints '2':

☞ f := { q := 2. }.
{ ☞ q := 1. f run. ✎ write: q. } run.

Does Citrine support object inheritance?

Yes. If you want to reuse old code, base your object on a previously crafted one (this is called prototypal inheritance):

RoyalCat := Cat new.
RoyalCat on: 'name' do: { :n
	↲ 'your royal highness ' + ( ⛏ `name ).
}.

Here, we override the behaviour for message 'name' with a new response. The symbol 'plays' back another response from the same object. To reference an overridden one, prefix the message with a backtick (`).

✎ write: ((RoyalCat new name: 'Diva') name).

Can I change built-in object?

You can modify existing objects (malleable objects), for instance, to make numbers respond to × :

Number on: '×' do: { :b ⛏ times: b. }.
7 × { :i ✎ write: i. }.

Does Citrine support magic methods?

Yes. You can make objects respond to arbitrary messages (generic responses):

echo := Object new.
echo on: 'respond:' do: { :s ↲ 2 × :s }.
echo ho!.

Why has Citrine no built-in functionality X?

Citrine is a minimalist language. The Citrine project focuses on producing a better language. You can add new functionality by using a plugin. Plugins are automatically loaded as soon as you start talking to the object. Put your plugins here:

mods/{plugin}/libctr{plugin}.so
$_

In line with the UNIX philosophy you can also invoke other programs to perform certain tasks using the shell:

✎ write: (Program  shell: 'ls -la').

This will print the contents of the current working directory on the screen.

How can I use a variable in a string?

Send an arbitrary message to a string:

✎ write: ('the answer is: this' this: 42).
	
the answer is 42

How can I use the icons in the examples?

Install 'Citrine.ttf' and configure your editor (I use Geany and Geany Macros, a macro package for Geany is included ):

cp ~/.config/geany/plugins/Geany_Macros/settings.conf ~/.config/geany/plugins/Geany_Macros/settings_backup.conf

cp macros.ini ~/.config/geany/plugins/Geany_Macros/settings.conf

$_

List of symbols:

icon code keys
26CFALT.
26BFALTk
261EALT=
2190ALT+
21B2ALT,
270EALT'
2264ALT<
2265ALT>
2260ALTu
2022ALT*
2009ALT; (thin space)

Can I use Citrine to write webapps?

Yes, Citrine ships with a CCGILIB-based HTTP plugin (mods/request/libctrrequest.so) that allows you to deal with GET and POST requests. you can use the Request object like this:

get  := Request get: 'search'.
list := Request getArray: 'orders[]'.
post := Request post: 'message'.
list := Request postArray: 'orders[]'.
file := Request file: 'avatar'.

Storm Server is a CCGILib based SCGI server for Citrine for hi-traffic web applications, to start an instance of Storm we put the following code in storm.ctr:

Request 
host: 'localhost' 
listen: 4000
pid:'/var/run/storm.pid' callback: {
	✎ write: 'Content-type: text/html\n\n'.
	☞ fname := Command env: 'DOCUMENT_URI'.
	☞ script := File new: '/var/www/htdocs' + fname.
	script include.
}.

 

Can I serve Citrine applications with NGINX?

Sure, add the following configuration lines to: /etc/nginx/nginx.conf:

location ~ \.ctr$ {
        try_files $uri $uri/ =404;
        scgi_pass 127.0.0.1:4000;
        include   scgi_params;
}

 

What platforms are supported? How do I distribute Citrine?

Citrine runs on 64-bit X86 Linux and 64-bit X86 OpenBSD. There is a 64 bit X86 Windows port available as well. Community versions for FreeBSD and macOS are available as well (but I don't know where, please contact the community members).
If you want to use Citrine as your main programming language for a certain project, I recommend using one of the versions available on the download page. If you want to teach programming using the Citrine programming language, I recommend providing your students with a Virtual Machine. Note that Citrine is still in alpha phase, be careful.

What makes Citrine interesting?

Programming in your native language might help to better solve complex coding problems (1), it allows non-technical people to better read and verify algorithms (2), it allows one to learn programming before learning the English language (in non-English speaking countries) (3), it might help developers world wide to converge to a common vocabulary for programming concepts (4), it might also serve as a DSL to replace overly complex graphical user interfaces (5) or form a language bridge between new and legacy code (6).

If Citrine respects all languages, why is this website in English?

As a developer, entrepeneur or scientist, you need to be able to read English texts. Citrine does not try to change that. However, writing complex programs in a foreign language is a different story. The Citrine project aims to reduce the number of mistakes in software by allowing everyone to use the language they know best. The manuals will still be mainly in English although translations in other languages may appear in the future or maybe summaries. The Citrine project also encourages ambassadors to host language specific implementations of Citrine along with translated manuals.

Is Citrine meant for non-programmers?

This is a common misunderstanding. Citrine is not meant for non-programmers. Citrine is and always will be a real general purpose programming language. However, even for professionals, programming in your native language reduces the number of mistakes. Citrine does try to make code as readable and maintainable as possible and helps to lower the barriers to programming for students and schools. However, Citrine is not an educational tool or a game to learn programming. In the end, Citrine is a full-fledged, powerful programming language that can be used for business purposes.

Why does Citrine NOT USE HTTPS?

The Citrine website no longer requires HTTPS because developing nations are part of the audience. Due to poor connectivity, internet connections in developing nations might rely on caching mechanisms that are incompatible with HTTPS/SSL.

What is the roadmap for Citrine?


Have another question?
Visit Citrine Programming Language Forum!
There you can talk to other Citrine community members, ask questions, discuss new features, issues, bug reports and so on.

gaborsoftware GaborSoftware offers support contracts for the Citrine Programming Language. Support ranges from just bootstrapping a simple Citrine installation to the setup of a language server for Citrine to work with automated code translations in international settings. Feel free to contact me for details. Custom plugins including MySQL, GTK or ZeroMQ can also be created and supported.

The Citrine Programming Language is a product of GaborSoftware © copyright 2018 all rights reserved. Citrine Programming Language created by Gabor de Mooij and the Citrine community. In-language (citrine.ttf) icons from the ionicons project (MIT licensed), FontAwesome (SIL OFL 1.1) by Dave Gandy - http://fontawesome.io and Typicons by S. Hutchings (SIL Open Font Licence).
Website and photography by Gabor de Mooij. 'Citrine in a box' icon created by Gabor de Mooij using multiple assets from the WikiMedia Commons Project.
Contact me:

Credits
Founder & Original Author: Gabor de Mooij
Windows version of Citrine: Twiggler
Foundation work Json & Curl plugins: MadcapJake
Special thanks to: DennisCGc, Takano32, LeoTindall, Janus, Shinriyo, Marianne.
Citrine Community

Citrine respects your privacy and does not use cookies. For details read the Citrine Privacy Statement.
29104 visits since 3 March 2018