Git Product home page Git Product logo

ceylon.language's Introduction

ceylon.language's People

Contributors

anhnhan avatar aslakknutsen avatar chochos avatar denizt avatar diegocoronel avatar emmanuelbernard avatar epaul avatar flaviooliveri avatar fromage avatar gavinking avatar gdejohn avatar ikasiuk avatar jvasileff avatar loicrouchon avatar lucaswerkmeister avatar mturk avatar olivergondza avatar pthariensflame avatar quintesse avatar ragaller avatar sadmac7000 avatar sgalles avatar thradec avatar tombentley avatar unratito avatar vietj avatar xkr47 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ceylon.language's Issues

Garbage classes

There are some classes lying around in ceylon.language/runtime that don't occur in ceylon.language/languagesrc. Some of them appear to be needed, e.g. Annotation. Others appear to be garbage from long ago, e.g. Any.

Stef, would you please help me figure out which are needed and which are not? Thanks!

backward spans and segments

When I implemented span() everywhere, I had it returning empty spans when to<from. Actually, this is supposed to be a reverse-order span.

A second issue is whether segment() should accept an integer as its second argument, allowing backward segments.

process.javaVersion and process.languageVersion

The tour talks about these two creatures, but they never got added to the language module!

I wonder if we actually need something like a Platform type to hold this info, since it could vary b/w JVM and JS.

Introduce Scalar type

Currently Numeric is a subtype of both Comparable and Number. But this isn't very nice for Complex numbers. So I propose introducting Scalar which mixes in Numeric, Comparable, and Number, and has Float, Integer, and Natural as subtypes. Then Integral would also be a subtype of Scalar. Any objections?

Use of Quoted in ceylon.language

Some of the attributes (e.g. name) in Module and Package descriptors are Quoted. If single quoted literals won't be supported till 1.1 how do we expect people to use the descriptors?

(It works in ceylon.language we just create a Quoted Java-side.)

List is broken

The List class either has to implement FixedSized, or it must not be used as return value for span and segment methods; nonempty cannot be used on it.

Some tests are breaking right now:

  [ceylonc] ceylon.language/test/sequences.ceylon:45: compiler message file broken: key=compiler.err.ceylon arguments=expression must be a type with fixed size: List<String> is not a supertype of FixedSized, {1}, {2}, {3}, {4}, {5}, {6}, {7}
  [ceylonc]     assert(nonempty singleton.span(0, 1), "nonempty singleton span(0,1)");
  [ceylonc]            ^

  [ceylonc] ceylon.language/test/sequences.ceylon:143: compiler message file broken: key=compiler.err.ceylon arguments=expression must be a type with fixed size: List<String> is not a supertype of FixedSized, {1}, {2}, {3}, {4}, {5}, {6}, {7}
  [ceylonc]     assert(nonempty result.span(0,0), "nonempty sequence.span(0,0)");
  [ceylonc]            ^

I think List should implement FixedSized (unless it's mutable but it doesn't seem to be).

StringBuilder methods should return this

StringBuilder would be a lot more useful if methods returned this instead of void, since calls could be chained as in sb.append("A").appendCharacter('B').appendNewLine().appendAll("C", "D").appendSpace().append("E").

This could also apply to SequenceBuilder, although there's not much point in that as it only has two methods, to append a single Element and a sequence of Elements.

Optional parameters of Exception

This:

throw Exception("Invalid Scheme");

Results in:

symbol  : variable Exception$impl
location: class ceylon.language.Exception
        throw Exception("Invalid Scheme");
              ^

I thought this used to be working.

Exception.printStackTrace should filter out the Ceylon runner stack

Only the first line is meaningful for us, so the rest should be filtered out. Potentially we may have to filter out more compiler-generated artifacts but that's a good start.

        at fr.epardaud.net_test.testAll.testAll(decomposition.ceylon:54)
        at fr.epardaud.net_test.testAll.main(decomposition.ceylon)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:85)
        at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:76)
        at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:66)
        at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:106)
        at ceylon.modules.Main.execute(Main.java:74)
        at ceylon.modules.Main.main(Main.java:53)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.modules.Module.run(Module.java:248)
        at org.jboss.modules.Main.main(Main.java:313)

Remove Equality

It looks like we can now merge the semantics of Equality into Object and remove the Equality interface, leaving == defined for any Object, which would greatly simplify a few things. See mailing list discussion titled "Object, IdentifiableObject and Equality". In particular, it lets us have well-defined equality for sequences.

Note that this requires first changing the compiler and typechecker!

String.split issues with tokens

It uses Java's StringTokenizer and I've never liked it much. For example, I believe that "a//b" tokenized by "/" should return three tokens: "a", "", "b". But it doesn't: it ignores empty tokens for some reason.

Some string conversions fail

I just ran ant publish test and found that certain tests fail because the wrong String is returned (or expected):

  [ceylonc] ceylon.language/test/numbers.ceylon:52: incompatible types
  [ceylonc] found   : ceylon.language.String
  [ceylonc] required: java.lang.String
  [ceylonc]     assert((1.0).string in {"1", "1.0"}, "float string 1.0");
  [ceylonc]            ^
  [ceylonc] ceylon.language/test/operators.ceylon:17: incompatible types
  [ceylonc] found   : ceylon.language.String
  [ceylonc] required: java.lang.String
  [ceylonc]     assert(!nonempty empty[].uppercased, "spread 1");
  [ceylonc]                      ^
  [ceylonc] ceylon.language/test/operators.ceylon:18: incompatible types
  [ceylonc] found   : ceylon.language.String
  [ceylonc] required: java.lang.String
  [ceylonc]     assert(nonempty full[].uppercased, "spread 2");
  [ceylonc]                     ^
  [ceylonc] ceylon.language/test/operators.ceylon:19: incompatible types
  [ceylonc] found   : ceylon.language.String
  [ceylonc] required: java.lang.String
  [ceylonc]     value spread1 = full[].uppercased;
  [ceylonc]                     ^

parseInteger() and parseFloat() supporting literal syntax

Further to #30 we need to fix parseInteger() and parseFloat() so that only numbers conforming to the Ceylon literal syntax for integers and floats, optionally preceeded with a sign character (+/-) , are accepted. E.g. parseInteger("+1_000") and parseInteger("-1k") should be allowed.

Overflow and ++/--

Ordinal.successor and Ordinal.predecessor are documented to throw OverflowException. Since ++ and -- are defined in terms of Ordinal this leads to the unintuitive fact that x++ can throw but x := x + 1 never will. Is this what we want?

Secondly, the compiler optimizes ++ and -- on Integer to a Java ++/--, so that overflow won't be detected. Which makes things even more unintuitive.

Remove Slots

Remove the Slots and FixedSlots interfaces and redefine the operators in terms of Set<Element>.

principal instantiation of intersection types doesn't account for refinement

interface Qux {}

interface Foo<out T> {
    shared formal T foo();
}
interface Bar<out T> satisfies Foo<T> {
    shared formal actual T&Qux foo();
}

void test<X,Y>(Foo<X>&Bar<Y> x) {
    value foo = x.foo();
}

In this code, foo should have type X&Y&Qux, but it actually gets the type X&Y in the current implementation.

object sequenceEntries in entries does not implement clone, lastIndex, rest and a few more

error encountered [formal member clone not implemented in class hierarchy] at 8:8-55:8 of entries.ceylon
error encountered [formal member lastIndex not implemented in class hierarchy] at 8:8-55:8 of entries.ceylon
error encountered [formal member rest not implemented in class hierarchy] at 8:8-55:8 of entries.ceylon

I tried but I have to admit I could not find the right method declaration (return type) for clone and rest.

This might be affected by issue #14

Spec typos

In section 4.5.6. of the spec:

  1. The return type of the method in the second code example should be Callable<Comparison,Integer,Integer> (two Ls, not one)
  2. The third code example is missing a + before lastName in the return statement.

Util.extendsClass() is broken for Java classes

All Java classes are subtypes of IdentifiableObject and Equality, but currently Util will only consider a class to be a subtype of these types if it has has explicit annotations specifying this. I suppose we need to take into account the absence of a @Ceylon annotation?

Move all backend implementation into its own package

We should move things like emptyIterator and all types required by the compiler into their own package rather than in ceylon.language.

Additionally we should probably remove the boxing methods of String, Integer, etc (value() and instance()) and put them into something like BoxUtils in that new impl package.

Note that this requires coordination with the compiler backend.

Are Lists sequences?

Should the relationship be:

  1. A List is a Sequence, and a String has a List of Characters, or
  2. A List has a Sequence, and a String is a List of Characters?

Note that String can't be a subtype of Sequence because we don't want to have to use Empty to represent the empty string.

UPDATE:

By way of explanation for the benefit of folks who are coming to this thread without sufficient context: sequences in Ceylon have that they are immutable as part of their contract. Sequence doesn't have add() and remove() methods. And the first operation of Sequence returns a non-null value. And so whether something is a Sequence or an Empty is statically determined.

One advantage of this, among others, is that it means that we can write a function like:

`T min<T>(Sequence<T> sequence) 
         given T satisfies Comparable<T> { ... }`

That has a non-null return type. This is better than what we can do if we want to accommodate the Empty case:

`T? min<T>(T[] sequence) 
        given T satisfies Comparable<T> { ... }`

One of the questions that this issue is implicitly touching on is:

Can you have a mutable List?

Clearly, if a List is a Sequence you would not be able to. (But we also have other motivations for thinking that interfaces like List, Map, and Set should have immutability as part of their contract.)

Integer on JVM and JS

On the JVM we can promise 64 bit Integers, but on JS we can't, since JS only has Number, which is double precision floating point. So we can't actually promise anything more than 52 bits (the significand). How are we going to cope with this?

Float.positive and zero

Float.positive is currently implemented as return value > 0. Similarly for .negative, this means that +0.0 and -0.0 are neither positive nor negative (just like NaN). We should document the expected behavior of zero.

The fact that foo.positive is not the same as ! foo.negative is likely to be a source of subtle bugs.

I think we should throw an exception for NaN.

Multiple parameter lists

Section 4.5.6 of the spec says:

A method which declares more than one parameter list returns instances of Callable.

Using the example given in the spec:

Comparison getOrder()(Integer x, Integer y) {
    return x<=>y;
}

If I try to call getOrder():

Callable<Comparison,Integer,Integer> c = getOrder();

I'm told "specified expression must be assignable to declared type: Comparison is not assignable to Callable<Comparison,Integer,Integer>".

NaN and collections

Java's Double.equals() treats NaN (and -0.0) specially so that NaN can be used in HashMaps and HashSets. Similarly Double.compareTo() treats NaN as equal to itself. Are we comfortable with NaN not be retrievable from hash-based and ordered collections?

Expected behavior of Singleton.segment

There are some assertions in the tests for Singleton.segment that indicate unintuitive behavior of Singleton.behavior, as well as contradictory ones:

assert(nonempty singleton.segment(0, 1), "nonempty singleton segment(0,1)");
assert(!nonempty singleton.segment(0, 0), "!nonempty singleton segment(0,0)");
assert(!nonempty singleton.segment(0, 1), "!nonempty singleton segment(0,1)");
assert(nonempty singleton.segment(0, -1), "nonempty singleton segment(0,-1)");

The first two are contradictory. I think the first one should is the correct one and the second one should be removed.
The third one should not be negated; I think singleton.segment(0,1) should be nonempty.
The fourth one, I think we had established that negative lengths for segment would return empty.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.