A Question From The Old Days

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

A Question From The Old Days

Post by WaltBrown » Fri Jun 12, 2009 4:15 am

I seem to remember from way back in early Mac developing, if certain variable names were kept to 4 characters they were compiled directly, but variable names over 4 were tokenized and added an additional dereference step during execution. Does anything like that still exist in RR?

Thanks,
Walt
Walt Brown
Omnis traductor traditor

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Jun 12, 2009 8:09 am

From http://www-psych.stanford.edu/~pinto/hc3.html :
How long can a variable name be?
--------------------------------

According to Winkler and Kamins in _HyperTalk 2.2: The Book_,
comments and blank lines are stripped before runtime and make no
difference in speed, and short variable names also have no impact on
speed. Both of these are listed as myths on pages 49. And
longDescriptiveVariableNames do make program code so much
more readable and understandable, for yourself 6 months to a year
from when the code was written and for anyone trying to learn from
your code.
Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Post by WaltBrown » Fri Jun 12, 2009 8:37 am

:-)
Walt Brown
Omnis traductor traditor

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld » Fri Jun 12, 2009 5:15 pm

Throughout both OS X and Windows there are a number of constants which, in languages that compile to native objects code, often compile to integers. Mac OS is historically fond of 4-byte constants for many things, such as the codes for special folder paths noted at:

http://developer.apple.com/documentatio ... 4g-C006668

For example, in C you could use the constant " kPreferencesFolderType" and with the header Folders.h it will compile to "pref".

Interestingly, you can pass those constants to Rev's specialFolderPath function to determine the paths to folders beyond the range Rev provides its own constants for, as noted at Ken Ray's site:

http://sonsothunder.com/devres/revoluti ... ile010.htm

But since Rev operates more like a virtual machine than a traditional compiler, that's about as far as it goes, and these conventions for some constants don't affect variables in any way, as Mark noted.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply