Difference between revisions of "Stateless and pure"

 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:ECMA]]
 
[[Category:ECMA]]
Proposal to have stateless routines to use the equal sign of constants, i.e.
+
 
 +
Stateless is first a semantic notion, meaning that a stateless feature does not refer to any state. To show that property to the clients, we add a syntactical notation based on the notion of constants in Eiffel, this looks like:
  
 
<e>f (a: STRING): SOME_TYPE =
 
<e>f (a: STRING): SOME_TYPE =
Line 7: Line 8:
 
         ...
 
         ...
 
     end</e>
 
     end</e>
 +
 +
With some validity rules:
 +
* only unqualified calls to stateless features are permitted.
  
 
With some validity rules for redefinition:
 
With some validity rules for redefinition:
 
* once a routine is stateless its redefinitions have to be stateless.
 
* once a routine is stateless its redefinitions have to be stateless.
 
* a stateful routine can become stateless.
 
* a stateful routine can become stateless.

Latest revision as of 06:13, 29 June 2011


Stateless is first a semantic notion, meaning that a stateless feature does not refer to any state. To show that property to the clients, we add a syntactical notation based on the notion of constants in Eiffel, this looks like:

f (a: STRING): SOME_TYPE =
    do
        create Result.make (a)
        ...
    end

With some validity rules:

  • only unqualified calls to stateless features are permitted.

With some validity rules for redefinition:

  • once a routine is stateless its redefinitions have to be stateless.
  • a stateful routine can become stateless.