XL (programming language): Difference between revisions

Content deleted Content added
PixelBot (talk | contribs)
Line 122:
 
The mechanism is used to implement all basic operators. An expression is progressively reduced to function calls using written forms. For that reason, the mechanism is referred to as ''expression reduction'' rather than operator overloading.
 
 
=== Iterators ===
 
XL iterators allow programmers to implement both [[Generator (computer science)|generators]] and [[iterators]].
 
<source lang="Pascal">
import IO = XL.UI.CONSOLE
 
iterator IntegerIterator (var out Counter : integer; Low, High : integer) written Counter in Low..High is
Counter := Low
while Counter <= High loop
yield
Counter += 1
 
// Note that I needs not be declared, because declared 'var out' in the iterator
// An implicit declaration of I as an integer is therefore made here
for I in 1..5 loop
IO.WriteLn "I=", I
</source>
 
== Development status and history ==