couple of questions
couple of questions
- Subject: couple of questions
- From: has <email@hidden>
- Date: Fri, 19 Oct 2001 02:02:35 +0100
I'm assuming the answer is 'no' to both, but anyway...
Whilst I'm quite content with dynamic variable typing overall, I do
slightly envy strongly typed languages in that having to declare a
variable's class up front provides protection against any value of a
different class slipping in there by accident. Whereas with AS it's
possible for a bad value to slide along for some distance in a process til
causing an unexpected failure in some other part of the program, if a
variable's type is declared and immutable then the error will be thrown at
source, making the problem much easier to trace. So is there ever any way
to override AppleScript's good natured intentions in this?
Is there any way to make a variable's value read-only? Again, probably not,
but it'd be handy if a variable could be created and, once the initial
value was set, locked down as "you can look, but you can't touch".
Of course, both problems can be solved easily enough by allowing indirect
access through handlers that'll do the checking/protection work for you,
but I was kinda curious if there was any deep or obscure way of doing it
directly. (I'm know I'm probably being unrealistic though.)
Cheers,
has
(p.s. If I'm murdering the terminology, forgive me. I'm still looking for a
good teaching book that'll give me the info I need in a way I can follow.
Still open to suggestions there.)