Ignore:
Timestamp:
Mar 23, 2024, 7:01:05 PM (3 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
caf2cba
Parents:
4094d05a
Message:

added Gregor and Andrew emails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/jiada_liang_MMath/relatedwork.tex

    r4094d05a re00b10d  
    25872587With valediction,
    25882588  - Gregor Richards
     2589
     2590Date: Wed, 20 Mar 2024 18:16:44 -0400
     2591Subject: Re:
     2592To: "Peter A. Buhr" <pabuhr@uwaterloo.ca>
     2593From: Gregor Richards <gregor.richards@uwaterloo.ca>
     2594
     2595
     2596On 3/20/24 17:26, Peter A. Buhr wrote:
     2597> Gregor, everyone at this end would like a definition of "enumerability". Can
     2598> you formulate one?
     2599
     2600According to the OED (emphasis added to the meaning I'm after):
     2601
     2602enumerate (verb, transitive). To count, ascertain the number of; **more
     2603usually, to mention (a number of things or persons) separately, as if for the
     2604purpose of counting**; to specify as in a list or catalogue.
     2605
     2606With C enums, if you know the lowest and highest value, you can simply loop
     2607over them in a for loop (this is, of course, why so many enums come with an
     2608ENUM_WHATEVER_LAST value). But, I would be hesitant to use the word "loop" to
     2609describe enumerability, since in functional languages, you would recurse for
     2610such a purpose.
     2611
     2612In Haskell, in order to do something with every member of an "enumeration", you
     2613would have to explicitly list them all. The type system will help a bit since
     2614it knows if you haven't listed them all, but you would have to statically have
     2615every element in the enumeration.  If somebody added new elements to the
     2616enumeration later, your code to enumerate over them would no longer work
     2617correctly, because you can't simply say "for each member of this enumeration do
     2618X". In Haskell that's because there aren't actually enumerations; what they use
     2619as enumerations are a degenerate form of algebraic datatypes, and ADTs are
     2620certainly not enumerable. In OCaml, you've demonstrated that they impose
     2621comparability, but I would still assume that you can't make a loop over every
     2622member of an enumeration. (But, who knows!)
     2623
     2624Since that's literally what "enumerate" means, it seems like a rather important
     2625property for enumerations to have ;)
     2626
     2627With valediction,
     2628  - Gregor Richards
     2629
     2630
     2631From: Andrew James Beach <ajbeach@uwaterloo.ca>
     2632To: Gregor Richards <gregor.richards@uwaterloo.ca>, Peter Buhr <pabuhr@uwaterloo.ca>
     2633CC: Michael Leslie Brooks <mlbrooks@uwaterloo.ca>, Fangren Yu <f37yu@uwaterloo.ca>,
     2634    Jiada Liang <j82liang@uwaterloo.ca>
     2635Subject: Re: Re:
     2636Date: Thu, 21 Mar 2024 14:26:36 +0000
     2637
     2638Does this mean that not all enum declarations in C create enumerations? If you
     2639declare an enumeration like:
     2640
     2641enum Example {
     2642    Label,
     2643    Name = 10,
     2644    Tag = 3,
     2645};
     2646
     2647I don't think there is any way to enumerate (iterate, loop, recurse) over these
     2648values without listing all of them.
     2649
     2650
     2651Date: Thu, 21 Mar 2024 10:31:49 -0400
     2652Subject: Re:
     2653To: Andrew James Beach <ajbeach@uwaterloo.ca>, Peter Buhr <pabuhr@uwaterloo.ca>
     2654CC: Michael Leslie Brooks <mlbrooks@uwaterloo.ca>, Fangren Yu <f37yu@uwaterloo.ca>,
     2655    Jiada Liang <j82liang@uwaterloo.ca>
     2656From: Gregor Richards <gregor.richards@uwaterloo.ca>
     2657
     2658I consider this conclusion reasonable. C enums can be nothing more than const
     2659ints, and if used in that way, I personally wouldn't consider them as
     2660enumerations in any meaningful sense, particularly since the type checker
     2661essentially does nothing for you there. Then they're a way of writing consts
     2662repeatedly with some textual indicator that these definitions are related; more
     2663namespace, less enum.
     2664
     2665When somebody writes bitfield members as an enum, is that *really* an
     2666enumeration, or just a use of the syntax for enums to keep related definitions
     2667together?
     2668
     2669With valediction,
     2670  - Gregor Richards
    25892671\end{comment}
    25902672
Note: See TracChangeset for help on using the changeset viewer.