Preliminary documentation for Ice 3.7.1 Beta. Do not use in production applications. Refer to the space directory for other releases.

Here are the constant definitions once more:

Slice
const bool      AppendByDefault = true;
const byte      LowerNibble = 0x0f;
const string    Advice = "Don't Panic!";
const short     TheAnswer = 42;
const double    PI = 3.1416;

enum Fruit { Apple, Pear, Orange }
const Fruit     FavoriteFruit = Pear;

The generated definitions for these constants are shown below:

Ruby
AppendByDefault = true
LowerNibble = 15
Advice = "Don't Panic!"
TheAnswer = 42
PI = 3.1416
FavoriteFruit = Fruit::Pear

As you can see, each Slice constant is mapped to a Ruby constant with the same name.

Slice string literals that contain non-ASCII characters or universal character names are mapped to Ruby string literals with these characters replaced by their UTF-8 encoding as octal escapes. For example:

Slice
const string Egg = "œuf";
const string Heart = "c\u0153ur";
const string Banana = "\U0001F34C";

is mapped to:

Ruby
Egg = "\305\223uf"
Heart = "c\305\223ur"
Banana = "\360\237\215\214"

See Also

  • No labels