Archived

This forum has been archived. Please start a new discussion on GitHub.

Why is the Java mapping for consts the way it is?

In the manual, the process for mapping from "const"s in a Slice file into Java is summarised as follows:
[E]ach Slice constant is mapped to a Java interface with the same name as the constant. The interface contains a member named value that holds the value of the constant.

Why does it work that way? Is there any reason that all constants in a namespace can't be mapped "public static final" members of a single class, or something like that?

Just curious,

MEF

Comments

  • marc
    marc Florida
    Unfortunately, that's not possible, since then all Slice constants for the given namespace would have to be known at translation time. However, this is not the case if you have constants in different .ice files, and if you translate the .ice files individually.