• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: enumerated types: best way to fake them?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: enumerated types: best way to fake them?


  • Subject: Re: enumerated types: best way to fake them?
  • From: email@hidden (Michael Sullivan)
  • Date: Wed, 6 Nov 2002 09:39:54 -0500
  • Organization: Society for the Incurably Pompous

has wrote:
> Michael Sullivan wrote:

> [on DIY enumerated types]
> >Sigh. I know I should just use strings, but I can't help myself.

> Not at all; if an enumerated type is what you need then that's what you
> should use. AS may not have them built in, but you can emulate them just as
> well, no guilt attached;).

Not really. You can emulate them like K&R C emulates them(IIRC), by
making integer variables. There's no actual type control.

> Paul Berkowitz wrote:

> >property apple : 1
> >property orange : 2
> >property banana : 3

> Gets my vote. (Tip: properties are also good for DIY named constants.)

Not mine. If someone accidentally sets apple to say 5 at the wrong
time, it could throw everything off (if one used copy at some point) .
Enumerated types don't have that problem because they can't be reset
like that.

But this is probably what I'll do anyway, although I like your idea of
using a record that's unlikely to be duplicated by accident.

With my style (and if this goes out to anyone else, it'll be
encapsulated in a script object), I don't think I'll have the problem
I'm talking about.


Thanks to Paul, Arthur, Andy and JD as well,

Michael
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: enumerated types: best way to fake them? (From: has <email@hidden>)

  • Prev by Date: Re: How do I Read and Write a list to a file
  • Next by Date: Re: Tid's 'n AS
  • Previous by thread: Re: enumerated types: best way to fake them?
  • Next by thread: Re: enumerated types: best way to fake them?
  • Index(es):
    • Date
    • Thread