From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_40,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c9eb1b85372010e8 X-Google-Attributes: gid103376,public From: smize@imagin.net (Samuel Mize) Subject: Re: private and limited private Date: 1996/10/17 Message-ID: #1/1 X-Deja-AN: 189975989 references: <53dfjn$1u@rc1.vub.ac.be> <53vmmb$560@saturn.brighton.ac.uk> organization: ImagiNet Communications Ltd, Arlington, Texas newsgroups: comp.lang.ada Date: 1996-10-17T00:00:00+00:00 List-Id: In article <53vmmb$560@saturn.brighton.ac.uk>, John English wrote: >Samuel Mize (smize@imagin.net) wrote: >: [... snip ...] > >: However, you can still copy it, and use the built-in equality test. >: This is generally OK. For instance, if you are representing playing >: cards, the type might be a record with two fields, one for suit and >: one for value. It makes sense to be able to copy a card value (e.g., >: for the program to remember what card was previously dealt), and to >: compare two values to see if they refer to the same card. > >Actually, playing cards would be better represented by a limited type >with a Move (as opposed to a Copy) primitive, since in the real world >you move cards from A to B, you don't *copy* them. But you can remember which cards have been played* (that's why casinos use several decks at the Blackjack tables)**. That's hard to represent with a limited type -- your "player" program can't make a "mental copy" of the values it's seen. >If you allow >assignment, you allow the creation of as many copies of the Ace of >Spades (or whatever) that you like. From watching Westerns, I gather >that most people frown on this and fill you with lead/break tables >over your head/whatever if you're caught doing it. Proof by existence that multiple copies of the same value are possible. * People do this at Gin Rummy and Bridge, for instance. ** It's called card counting. It's described in various books, and there's probably a blackjack newsgroup. The move "Rain Man" describes it, although the details are wildly inaccurate. Samuel Mize