On Monday 21 February 2005 17:56, Marty Kraimer wrote:
> Benjamin Franksen wrote:
> > What I want to point out is that there is one very useful
> > thing missing from the data model, namely algebraic data types, a.k.a.
> > tagged unions. A syntax could look like this
> >
> >union(name) {
> > choice(choice_name,"choice_value",choice_data)
> >}
> >
> >where 'choice_data' can be any valid data type, including struct or
> > another union. Thus, menu would be the special case where the
> > 'choice_data' is void (or null; another basic data type to be added).
>
> Andrew also suggested a union.
>
> JAVA does not have a union. Will this cause us any problems?
Well, neither does the C union fit exactly. You have to combine it with a tag
to discriminate cases; and the type system does not enforce any match between
tag and data content, so in the end we'll have to implement it as an ADT.
In Java, we would have to cast the data to an 'Object' and back, according to
the tag value. I think the implementation is in fact easier in Java than in
C.
Ben
- References:
- Re: EPICS base V4: iocCore database Marty Kraimer
- Navigate by Date:
- Prev:
Re: EPICS base V4: iocCore database Benjamin Franksen
- Next:
Re: EPICS base V4: iocCore database Benjamin Franksen
- Index:
2002
2003
2004
<2005>
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: EPICS base V4: iocCore database Marty Kraimer
- Next:
Re: EPICS base V4: iocCore database Benjamin Franksen
- Index:
2002
2003
2004
<2005>
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|