0

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";
}
drhagen
  • 8,331
  • 8
  • 53
  • 82

1 Answers1

2

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.

Lucas Werkmeister
  • 2,584
  • 1
  • 17
  • 31
  • 1
    I’ve [submitted a pull request](https://github.com/eclipse/ceylon-lang.org/pull/499) to update the documentation. – Lucas Werkmeister Mar 31 '18 at 22:00
  • 1
    I guess the my real question was "Where is `pi` and `sqrt` and things like that?" and this answers that also. – drhagen Mar 31 '18 at 22:05
  • 1
    Actually `ceylon.math` is deprecated, and you should now use `ceylon.numeric`, `ceylon.whole`, and `ceylon.decimal`. `pi` and `sqrt()` are in `ceylon.numeric`. – Gavin King Apr 01 '18 at 13:03