Don't amputate numberFormat (was: affecting array keys???)

Curry Kenworthy curry at pair.com
Fri Apr 21 20:51:14 EDT 2017


Mark Waddingham:
 > I think this is perhaps more evidence that 'numberFormat'
 > should probably be deprecated - or at least marked as
 > 'present for HyperCard compatibility only and shouldn't
 > be used in new code'.

I emphatically disagree.

There's nothing wrong with numberFormat as a binary to text option. On 
the contrary, it's a splendid way to present the formatting to users. 
The array key example is an outlier case to watch out for, but it's also 
easy to use an alternate formatting option or careful coding for those 
rare cases.

The numberFormat is very easy to read and clean, similar to formatting 
systems used by Excel and others. (Naturally SpreadLib uses it too.) 
People understand the representation intuitively, and it's also 
extremely popular.

It provides a consistent shortcut compared to using a function several 
times, for clean code with one statement to edit, so it is compatible 
with KISS philosophy.

I prefer numberFormat for most tasks and would detest having it 
deprecated. Obviously the show must go on when someone concatenates text 
with a number, so a default behavior would have to be in place for that 
regardless (unless LC would throw an error), but we would lose the 
customizable aspect. LiveCode will be disfigured if we hack off all the 
pleasant parts.

It will also be less "English-like" than before if we remove the wrong 
parts. I've been working on materials for my new fluency method for 
teaching LiveCode's syntax, based on proven language learning methods 
and enhanced with my own additional techniques geared to CS and LC.

This is such a readable sentence to teach and use:

set the numberformat to "0.00"

Although I don't have time to be as vocal an advocate as some others 
here on LC trends and directions, there's so much to be said on the 
subject of LC's English-like language, how to optimize learning and 
coding around it, and what the result offers compared to other computing 
languages. (But I'll say most of that in my upcoming book rather than 
here on the list.)

I sure don't intend to teach the best parts of LC as deprecated or 
denigrated, so I hope the language stays intact without self-mutilation. :)

Best wishes,

Curry K.




More information about the use-livecode mailing list