What is "Open Language"?
Mark Waddingham
mark at livecode.com
Tue Oct 27 12:39:17 EDT 2015
On 2015-10-27 17:09, Bob Sneidar wrote:
> I would say LC is "typeless" as far as it can be. Graphic data is not
> strictly typeless, data read in as binary is not typeless, etc. In
> fact, any attempt to reduce *ALL* data to strings would be a horrible
> mistake. I guess I'm saying that I appreciate not having to worry
> about typing until it can't be helped.
I think that is generally why typeless languages are generally
scalar+array languages - as not being able to build general collections
is quite limiting...
HyperCard was probably what you could call 'pure typeless' - as
everything was a string, and didn't have arrays.
Pre-7 LiveCode was definitely scalar+array.
Post-7 though, LiveCode now sits on a dynamically typed underbelly and
aspects of the dynamic typing do start to 'poke through' a little more
(perhaps regrettably). Unfortunately in order to ensure transparent
Unicode *and* allowing existing code to run unmodified it was necessary
to expose an explicit division between text and binary data -
principally because the 'native encodings' used for text on each
platform were not the same as the first 256 Unicode codepoints.
It is an interesting (at least to me) exercise to consider how one might
make a variant of LiveCode which was truly typeless and (once again -
like HyperCard) treated 'string' as the universal datatype. For example:
- nothing: the empty string
- booleans: "true" and "false"
- numbers: decimal arithmetic with arbitrary precision (obviously
transcendental operators would need to use some local property to
determine precision)
- strings: sequence of Unicode codepoints
- data: a string where each codepoint < 256
- lists: 'item' delimited strings
However, at this point one gets into the question of 'collections'.
Really you are limited to either table-like strings (i.e. two
dimensional arrays), or dictionary-like strings (i.e two items per line,
first item key, second item value). This is obviously really quite
limiting - you would lose 'nested' arrays, and higher-dimensional
arrays.
The above should be possible to do in an entirely self-contained, and
internally consistent way though - in that arrays are line-delimited
lists, and dictionaries are line-delimited two element lists. You could
consider a tree-like string representation for nested arrays, but then
you lose a fair bit of synergy between the other data-types and at that
point you might as well start thinking about adding a collection type
(i.e. LiveCode arrays) and thus the goal of making something purely
typeless is gone.
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