Hi Vitali, At present the compiler does not support referencing a member of a constant, nor computing basic arithmetic, etc. I think it would be cool to add support for these things to the language, but personally I haven't yet had a need for it.
-Kenton On Fri, Oct 4, 2019 at 7:24 PM <[email protected]> wrote: > I was wondering if it's possible to derive one constant from another? > > Something like: > > struct Foo { > a @0 :Float32; > b @1 :Float32; > }; > > const oneWay :Foo = ( a = 1.0, b = 2.0 ) > const orAnother :Foo = ( a = .oneWay.b, b = .oneWay.a ) > > And of course expanding this wondering if basic math operations like > negation or even addition/subtraction are supported in these references? > > Thanks, > Vitali > > -- > You received this message because you are subscribed to the Google Groups > "Cap'n Proto" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/capnproto/31976e19-18e5-445c-914f-13d1be133f06%40googlegroups.com > <https://groups.google.com/d/msgid/capnproto/31976e19-18e5-445c-914f-13d1be133f06%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/CAJouXQ%3DtiM%2Bq_aQtJu_wpcTX0CQZuEkqwSr%2B%3DyHF8PUiBbHd9w%40mail.gmail.com.
