Introduction
Getting Started
Basic Syntax
Structures
Enumerations
Roles
User Interface
Procedures
Expressions
Translators
Contact, Questions, Discussion
Legal Notes
Updated 02/08/2018
All contents and concepts
©Webware nach Maß |
The Readable Programming Language - Handbook |
ExpressionsNumbersA number constant in Lisilogic is written in the usual computer notation, without spaces.
The precision and maximal values are the best ones allowed both by the programming environment (i.e. Java) and by the target language and database of the application (see Translators). In Lisilogic, numbers can be associated with a unit, indicated after them, and carry along their precision. See Basic Syntax: Numbers. Note that the dot (.) is also the sign used to mark the end of each sentence (see Basic Syntax: Sentences).
That's why a number constant can't end with a dot: a dot not followed by a digit (0 to 9) will be interpreted as the end of the sentence, not as part
of a number. Character StringsText constants are defined between double quotes ("") and introduced by the words the text.
A text constant will be considered a short string if it is not longer than 30 characters and if it doesn't contain any line break. Otherwise it is a text (see Structures: Basic Types). Conversions are automatic. Double quotes not introduced by the words the text will be interpreted as an enumeration value (see Enumerations),
and converted to a short string, a text, an email address, a list of email addresses, a url, a list of enumeration values, a number, etc.
(see Structures: Basic Types) when appropriate. Note that Lisilogic must have an information about the type whished in order to proceed to a conversion: Double quotes and opening braces placed between double quotes must be preceded by a backslash (\). See also Basic Syntax: Character Strings. Simple ConstantsThe constant null has no type, it will be interpreted differently depending on its utilization (empty attribute, empty list, boolean false, number 0, empty character string, ...). It is also the value of any unreachable or not yet initialized attribute, see below. false and true are the usual boolean values. In comparisons, false is smaller than true. now is the current timestamp and today is the current date. the application is the single instance of the application structure, see Structures: Predefined Structures. Contextual Constantsthe user is the instance of the user structure representing the logged in person (see Structures: Predefined Structures). It will be null if the person using the application is not logged in (it is a visitor, see Roles). the given followed by a type name (structure or simple type) accesses the value passed as a parameter to a procedure
(see Procedures), a page or the application, or a widget (see User Interface). the current followed by a type name (structure or listable simple type) accesses the value being handled when iterating over a list. See User Interface: List and Table Displayers, Procedures: Loops. Attribute PathsAn attribute of a structure instance (see Structures: Attributes) is accessed using 's:
Unlike other programming languages, Lisilogic has no "NullPointerException" or "Trying to get property of non-object" error:
reading any attribute of null is allowed and will return null. Note that the length of a character string and the element count of a list aren't structure attributes (strings and lists aren't structures). For now, Lisilogic allows to evaluate them only with the corresponding operators the length of and the count of (see below), not with 's. Contrarywise, structure attributes can't be accessed with "the ... of". This may change in the future. PronounsIn structure definitions (see Structures) and in "create" statements (see Procedures: "create" Statement)Use its followed by an attribute name to define or initialize the corresponding attribute. In "can" sentences (see User Interface and Roles), including anonymous procedureshe and himself refer to the role being defined, which will be an instance of the user structure if the person using the application is logged in, null otherwise. This is identical to the contextual constant the user. his is the normal possessive pronoun corresponding to he.
In the future, he and himself in a "can" sentence about the visitor role may return a temporary visitor structure. them can only be used in list or table viewers (see User Interface: List and Table Viewers) and refers to the element of the list being handled during the iteration (the row for a table viewer). It is identical to the contextual constant the current .... their is the normal possessive pronoun corresponding to them. It can also be used in list filters (see below).
it refers to the value passed as a parameter to the page or widget being defined. It is identical to the contextual constant the given .... It will be null if no parameter value has been passed. its is the normal possessive pronoun corresponding to it. Note that Lisilogic will understand "it's" as an attribute path identical to "its" instead of the correct grammatical meaning "it is". Many human people do a comparable mistake. It is recommended to use only "its" and "it is", not "it's". Note that since the parameter of a page or a widget isn't defined explicitely, the readers of the code might expect "it" and "its" to refer to something else (the current element of an iteration, the last mentioned object, ...) or the passed parameter to be referred to using other pronouns ("him", "his"). In (anonymous) procedure definitions, the special usage of "its" in "create" statements (see above) may also interfere. It is recommended to use the given ... to prevent any ambiguities. In "To" sentences (see Procedures)it refers to the value passed as a parameter to the procedure being defined. It is identical to the contextual
constant the given .... its is the normal possessive pronoun corresponding to it. Note that Lisilogic will understand "it's" as an attribute path identical to "its" instead of the correct grammatical meaning "it is". Many human people do a comparable mistake. It is recommended to use only "its" and "it is", not "it's". Note that the readers of the code might expect "it" and "its" to refer to something else (the current element of an iteration, the last mentioned or created object, ...) or the parameter passed to the procedure to be addressed using other pronouns ("his", "him"). The special usage of "its" in "create" statements (see above) may also interfere. It is recommended to use the given ... to prevent any ambiguities. them can only be used in loop statements (see Procedures: Loop Statements) and refers to the element of the list being handled during the iteration. It is identical to the contextual constant the current .... their is the normal possessive pronoun corresponding to them. It can also be used in list filters (see below). he, him and the possessive his refer to the person who's using the application, not to the parameter passed to the procedure, even if it is a role object (see Roles: Role Objects). It is recommended to use the user instead. Unary Operatorsthe length of returns the length of a string in characters. the count of returns the number of elements of a list as a whole number without unit. Special operators for dates and timestamps (the month of, the day of, the minute of, ...) are planned. Note that the size of a file and the width, height and size of an image are attributes of these predefined structures, accessed with 's instead of "the ... of". In the future, Lisilogic may allow 's for length and count and "the ... of" for attributes. Arithmetic OperatorsThe operators plus (+), minus (-), multiply (asterisk, *) and divide (/) have their usual meaning between numbers. The units, including percent (%), will be combined correctly, see Basic Syntax: Numbers. Lisilogic tries to give a reasonable meaning to arithmetic operators used with other data types than numbers: adding a duration to a date or timestamp results in a new date or timestamp, subtracting a date or timestamp from another one returns a duration, adding an element to a list will return a new list, adding two listable elements will produce a list, subtracting an element or a sublist from a list and appending two character strings are possible, etc.. Note that the difference between string constants (introduced by the words "the text") and enumeration values (in double quotes without "the text", see Basic Syntax: Character Strings) may interfere: adding an enumeration value to a string results in a string, whereas adding two enumeration values results in a list. ParenthesesThe priorities of the operators are normal, and you may use parentheses ( ) in arithmetic expressions. Note that for readability's sake, parentheses are not allowed in logical expressions (operators and and or, see below). Use cascading "if" statements instead. Comparisons, Notification TestsThe comparison operators are equal to, smaller than, greater than, in,
contains, starts with and ends with.
Note that smaller and greater mean "strictly smaller" and "strictly greater". There are no "greater or equal" or "smaller or equal" operators, use "not smaller" or "not greater" instead. All comparison operators result in a boolean and will try to find a reasonable meaning if their operands are of unexpected types, issueing an error if they don't succeed. The comparison operators "after" and "before" are in study, especially regarding their meaning for string constants (caseless comparison?) and the possibility to test the ordering of elements in a list. there are or there are no followed by a notification type (success, error,
warning, or just notification for any of these) test if notifications of this type have been issued and will
be visible on the next displayed page. See also Procedures: "issue" Statement. Logical OperatorsThe operators and and or are available. Note that the previous parts of a sentence don't change the meaning of pronouns: "if the user's address is null or its zip_code is null" is not a correct replacement for the previous example. and has a stronger priority than or, but since the consequences of this convention aren't obvious to anybody, especially not to non-programmers, it is recommended to use cascading "if" statements instead of nested logical operators. For now, Lisilogic doesn't allow parentheses in logical expressions. This might change in the future, if research finds a way to restrict their utilization to cases where non-specialists still can understand the code. The possibility to use "and" or "or" to produce lists ("set the user's roles to salesperson and supervisor") is in study. allall followed by the name of a structure will return the list of all instances of this structure present in the database. Role objects are always replaced with the users who own them (see Roles: Role Objects, so "all" followed by a role name will in fact return all users whose "roles" attribute contains the given role. List FiltersA list expression can be filtered with the operator having followed by a condition (see above) to be evaluated on each element of the list. Element extraction operators (... having maximum/minimum ...) are in development. |