Monte Goulding's day off? ; -) the outcome.

Mark Waddingham mark at livecode.com
Fri Jul 1 04:51:38 EDT 2016


On 2016-07-01 10:26, Peter TB Brett wrote:
> At the moment, the bridging rules from LiveCode Script to LCB types
> and vice versa make the JSON library extension very nice to use from
> LCB and reasonably usable from LCS.

The LCB extension differs from mergJSON though in that it actually can 
return 'numbers' to LCS - these are then affected by 'the numberFormat'. 
This is almost as good as a 'stringy-number' - although you do, of 
course, lose the original string representation.

Of course, the idea of 'stringy-number' could just be recast as a 
Decimal-number-represented-as-string type (which is what it is the more 
I think about it) - something that would just converted to a binary-fp 
representation when you do something numbery on it; or appropriately 
apply the numberFormat to the string rep when something stringy is done 
with it.

> To implement the scheme you describe above, the current JSON extension
> would need to be split into three parts:
> 
> - An event-driven lexer/parser module that does no type conversion at
> all but calls a set of callback handlers as it passes through the JSON
> document
> 
> - A module for use from LCB that does LCB type conversion
> 
> - A library for use from LCS that doesn't do any type conversion at all

Or a parameter which says 'don't convert token values?'? ;)

Alternatively, if we had a DecimalString representation for Number (as 
described above) it would be a simple change - construct DecimalString 
number-rep from token string rather than the binary-fp number rep.

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