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

Mark Waddingham mark at livecode.com
Mon Apr 24 10:06:37 EDT 2017


On 2017-04-22 02:51, Curry Kenworthy via use-livecode wrote:
> 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.

Don't worry - I don't entirely agree with my suggestion either :)

I must confess I was being overly pejorative in order to provoke a
conversation - something I have a tendency to do from time to time in
order to help get a greater understanding of things.

> 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.

I'd disagree that anything involving the use of arrays could be 
considered
a 'rare case' or an 'outlier case'; so it is irksome that a feature
(numberFormat) which is meant to make working with the display of 
numbers
'easier' is somewhat incompatible with it.

I'd mind less if numberFormat was actually had wide utility - but, in 
reality,
for all but the simplest of cases (wanting US/UK style numbers, with
preceding or following '0's) it isn't very useful.

To be fair, that is fine - the problems which keep recurring could
probably be mostly dealt with by much better documentation of 
numberFormat.
i.e. Clear explanation about how it affects computations, and when to 
use it
and when not to

That, however, does still leave me 'wanting' though. As you point out 
the
*idea* is so ergonomic that it *seems* like it should be much more 
powerful,
but it is not, and if you want to use it easily with other parts of the
language, you are probably best not to use it at all.

I can guarantee that nothing is going to happen to numberFormat (beyond
perhaps improving its documentation) any time soon - if ever. Indeed,
it wouldn't ever disappear just evolved (assuming we can figure out how
to make it a) more powerful and (b) play more nicely with LiveCode's 
more
modern features!).

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