Rename REAMDE to README.md
[nit.git] / tests / test_prog / platform / platform.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Declares base types allowed on the platform.
16 module platform
17
18 import end
19
20 # Root of everything.
21 interface Object
22 # Used for comparisons.
23 type OTHER: nullable Object
24
25 # Is `other` equqls to `self`?
26 fun ==(other: OTHER): Bool is intern
27
28 # Is `other` different from `self`?
29 fun !=(other: OTHER): Bool do return not self == other
30 end
31
32 # Some services about Integers.
33 class Int
34 fun -: Int is intern
35 fun +(i: Int): Int is intern
36 fun -(i: Int): Int is intern
37 fun *(i: Int): Int is intern
38 fun /(i: Int): Int is intern
39 fun >(i: Int): Bool is intern
40 fun to_f: Float is intern
41 end
42
43 # Some services about Floats.
44 class Float
45 fun +(f: Float): Float is intern
46 fun -(f: Float): Float is intern
47 fun *(f: Float): Float is intern
48 fun /(f: Float): Float is intern
49 fun >(f: Float): Bool is intern
50 end
51
52 # Booleans, `true` or `false`.
53 class Bool end
54
55 # Strings (there is no chars...).
56 class String end
57
58 # List of things.
59 class List[E] end