At 10:05 PM +0200 on 7/21/99, M. Uli Kusterer wrote:
>>I thought a lot about this, and I don't see why one couldn't
>>"optionally" specify the type of a variable.  Once the type
>>was declared it would be unable to be used in any other
>>context (until we added implicit or explicit conversion),
>>but the advantage could be a performance increase for
>>operations using that variable.
>
>Michael,
>
>optionally isn't bad to increase performance, but it would also make xTalk
>a lot more computer-ish. Also, I think Anthony has done a great job with
>OTVar and the speed gain of hard typed variables over OTVar shouldn't be
>very big.

It will be very big -- something on the order of ten to twenty times
faster, unless you've got some _great_ optimizer -- i.e., one far better
than I've seen!

>However, if you really compelled, I propose the following: Make
>it an undocumented feature, that is, make it a feature for which we don't
>make any promises, and which isn't part of the regression tests.
>
> So, basically this would just be a hack, which would let professionals
>increase the speed, but wouldn't disturb newbies. It'd be part of the
>"hacker myth" of advanced scripters. Of course, undocumented is only
>officially. We would include a tech note which tells our users about this
>feature, and that it might go away any time.

Better would be to just tell users "you may safely ignore this command".

You'll have people even more confused with documented-yet-undocumented
commands.

>
> But honestly, I'd prefer if xTalk was smart enough to determine the
>variable's type from the way it is used, like CompileIt tries for HyperTalk
>scripts. This could work by simply keeping track of how a variable is used
>when compiling and then using the type used most as the default type for
>the variable, doing temporary conversions on other occasions.

Requires more code and one or more passes through the source to do this.

>
> One more thing: Have a non-programmer devise the names of the data types.
>Most non-programmers don't find "string" very natural, they prefer "text"
>etc. "float" should be "number", for example, while "integer" is used for
>integer numbers etc.

True. But I'd prefer "real" for reals, and "integer" for integers.
Otherwise, people would get confused ("but an integer IS a number--why
seperate?!"). This way, they'd know that one was intended for decimals and
one for integers. Or maybe "decimal" would be a better type name.

Reply via email to