Elan 2.0
- It applies the technology and philosophy of Elan to coding in Python, VB, C#, and Java
- It can convert code instantly between these languages
- Code in all languages is saved as a .elan file in a language neutral format, called the 'Reference Language'.
Only .elan files may be loaded into the IDE,
though after loading they will then automatically translated into the target language,
which is saved in the 'header comment' of the file.
- You may 'export' code (via the File menu) as, for example, a .py file, for loading into a different IDE.
Note that the exported code may still be using Elan library methods and Types.
However, we will – before the full 2.0 release – be making a version of the Elan library available
as native .py, .vb, .cs, and .java code to facilitate running a program written in Elan within another IDE.
As well as writing code directly in Python, VB, C#, or Java,
you can write and run code directly in the Reference Language.
- In all the target languages Elan deliberately imposes restrictions on coding patterns
that would not necessarily be imposed when writing in that language in another IDE.
These restrictions are of two distinct forms:
2.0.0-alpha1 - limitations and known issues
- Alpha1 supports procedural programming only.
OOP will be added in 'alpha2', and Functional Programming (FP) in 'alpha3'.
- Auto-completion is neither complete, nor completely consistent:
it might not show some expected items, and might show some that aren't applicable, but you can always
just type the names that you want in full.
- The online documentation (help) is a work in progress.
Generally it has been kept up to date with changes to Elan, but some areas are incomplete.
Before we get to full release, the online help system will be such that whichever language you are working on,
the online documentation will automatically show all code examples in that language.
- Worksheets have been temporarily removed, pending updates.
When restored, they will automatically present in the same language that you have selected in the editor.
The Elan 2 IDE
- Is completely free
- Runs within a browser, meaning that there is no install required, nor any registration. It may
be installed on a school server, or just saved as a web page on the desktop, such that it may
be used without Internet access.
- Has a powerful 'frame-based editor' that:
- reduces the need for typing
- eliminates the possibility of many forms of syntax error
- provides a common language for kinds of instruction such as 'variable', 'constant', 'set', 'procedure', 'function'
- Has a built-in library that works identically in all languages
- Provides four kinds of graphics – Turtle, Block, Vector, and Html – that work identically in all languages
- Has a simple, but powerful, debugger
- Offers integrated documentation that is linked directly from the code
- Supports integrated worksheets
- Is guaranteed '100% AI-free`
- Deliberately prevents pasting in .py, .vb, .cs, or .java, code from an external source
The 10 commandments of good programming
There are many more than 10 widely recognised principles of good programming practice. These 10
have been singled out because the designers of Elan believe that anyone learning to program
should never learn to break any of them in the first place,
and that they should ideally be enforced by the programming language.
Elan 1.0 was the first language, designed for education, that enforced all 10.
Elan 2.0 enforces them, through its Code Editor, when writing Python, VB.NET, C#, and Java.
- Thou shalt not define any global variable
- Thou shalt not change any constant
- Thou shalt not change the Type of any variable
- Thou shalt not create any null reference
- Thou shalt not break out of any loop
- Thou shalt not exit any method before its end
- Thou shalt not create any impure function
- Thou shalt not access any private member
- Thou shalt not inherit from any concrete class
- Thou shalt not override any concrete method
The nature and rationale for each of these commandments will be more fully explained in future documentation.
Coding restrictions designed to guarantee portability
These restrictions exist to ensure that all code generated within the Elan IDE may be automatically
translated with 100% correctness from any one supported language into any other.
It is not necessary to know these rules, because there is either no mechanism to break them or
you will receive a clear message if you do. Each of these restrictions exists to prevent
use of coding features that are supported in some languages,
but have no equivalent syntax in at least one other.
The surprising thing, we suggest, is how few such restrictions are necessary.
- Loops
- The 'for each' syntax is used even for a traditional 'for' loop, by means of the range method.
- A 'repeat...until' loop must be implemented using the 'while' loop syntax
- Literal strings
- are always bounded by double quotes: "apple"
- 'interpolated strings' use the syntax specific to each language (for Java that is the
String.format
str.format
string.format
String.format
String.format method).
- Identifiers
- are case sensitive, but you cannot have two in the same scope that differ only by case.
- may not conflict with reserved words in any of the languages. In such a case you
may just extend the identifier e.g. using
new code
new code
main()
new code
new code
new code
- Identifiers
- are case sensitive, but you cannot have two in the same scope that differ only by case.
- may not conflict with reserved words in any of the languages. In such a case you
may just extend the identifier e.g. using
next_
next_
next_
next_
next_ instead of next
next
next
next
next.
- Operators
- Two integers may not be divided using '/'. You use the divAsInt or divAsFloat depending on the result you need.
- The equality operator may be used only for numeric or Boolean Types.
To test equality of strings, and all other Types, you must use the equals or notEqualTo function.
- The 'power' operator '^' is not recognised for any language, You use the pow function instead.
- Indexing
- A 2D array is implemented as a list of lists, and accessed with double index e.g. [3][4],
but it may be initialised (like an an array) using any of: createList, createListOfLists, or createBlockGraphics
- An index value cannot be negative
- Exceptions/errors. You cannot access the exception instance within a catch clause(s).
- Tuples. Items are accessed by e.g.
myTuple.item_0
myTuple.item_0
myTuple.item_0
myTuple.item_0
myTuple.item_0, myTuple.item_1
myTuple.item_1
myTuple.item_1
myTuple.item_1
myTuple.item_1. They may
not be accessed by index, nor is 'tuple deconstruction' (into separate variables) supported.
- Passing by reference is possible only within a procedure and to do this you use the Ref Type
which acts like a wrapper around the instance of interest.