ceylon

Where is the math module?


The first import mentioned in the Tour of Ceylon is

import math { sqrt, pi, Complex }

What do I need to put in my modules.ceylon in order to be able to import this math module? It is not either of these:

module my_module "1.0.0" {
    import math "1.3.3";
}

module my_module "1.0.0" {
    import ceylon.math "1.3.3";
}

Solution

  • I think this example is intended to be fictitious, just like the other three imports below. (I’m not sure if it’s intentional that some of those have com.example and some have org.example, either.)

    There is a ceylon.math module in the SDK (documentation), but it’s deprecated, having been replaced by ceylon.numeric (contains pi and sqrt()), ceylon.whole, and ceylon.decimal. A Complex class is nowhere to be found in the entire SDK.

    Generally, package names must match the module name prefix, so a single-component package name like math could only be part of the math module – a module name that would be highly discouraged.