What is "Open Language"?

Mark Waddingham mark at livecode.com
Tue Oct 27 06:20:20 EDT 2015


On 2015-10-27 10:22, Monte Goulding wrote:
>> On 27 Oct 2015, at 8:02 pm, Mark Waddingham <mark at livecode.com> wrote:
>> 
>> Note that in all three 'operator' cases, you can also have expressions 
>> in-between the tokens:
>>     <Expression> 'is' 'between' <Expression> 'and' <Expression>
> 
> Out of interest if I implement the above syntax but only for
> expressions that evaluate to a number can someone else implement it
> for expressions that evaluate to strings or some other thing. Can the
> be used together by some other user that doesn’t care about the
> implementation detail?

There are two ways to interpret your question...

Option (1):
    Person A: x OP y => EvalOP(in x as integer, in y as integer) returns 
array
    Person B: x OP y => EvalOP(in x as string, in y as string) returns 
boolean

Option (2):
    Person A: x OP y => EvalOP(in x as integer, in y as integer) returns 
integer
    Person B: x OP y => EvalOP(in x as integer, in y as integer) returns 
string

The difference here is that in Option (1), you can have differing return 
types as long as the types of the parameters are different. In Option 
(2), you can have differing return types even if the types of the 
parameters are the same.

Open Language definitely allows Option (1) - it is the basis of how 
'specialization' of syntax can work for different argument types. This 
model is one where 'types flow downward' to work out how which variant 
to call.

Now, Option (2) is quite different - it means that the context of the 
use of an expression can be used to choose which form to call. This 
could work with the type-system in LiveCode Builder - I doubt it could 
be made to work effectively in LiveCode Script, too many ambiguities 
would arise (as the type required in a given context in LiveCode Script 
is often flexible).

That being said Option (2) is a proper superset of functionality for 
Option (1) so it is something we can explore at a later date. From all 
the work I have done up until now, Option (1) appears to be more than 
sufficient a model for currently existing LiveCode Script, and the 
purposes LiveCode Builder is currently being put to.

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list