New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core 2.0 - remove runtime exceptions #86

Closed
wants to merge 5 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@laszlopandy
Contributor

laszlopandy commented Jan 9, 2015

Core 2.0:

  • Remove runtime exceptions:
    • Changed type List.head : List a -> Maybe a
    • Deleted List.tail in favour of List.drop 1
    • Deleted List.foldl1, List.foldr1, List.scanl1
    • Added List.uncons
    • Changed List.maximum and List.minimum to take default values
  • Added Graphics.Model
    • Including Debug will not include Collage or Element
    • Public types are re-exported from the same module as before.
    • Private types which were exposed before are now hidden: BasicForm, LineCap, LineJoin, ShapeStyle, FillStyle, ElementPrim, ImageStyle, Three.
    • Since no one should have been using the private types, I don't expect any breaking changes from the Graphics.Model refactor.
  • Fixed compiling while doing breaking changes in core: run-test.sh will now delete the elm-package version of core and symlink it to the local git version.

@laszlopandy laszlopandy changed the title from List no throw to Core 2.0 breaking changes Jan 9, 2015

@laszlopandy laszlopandy changed the title from Core 2.0 breaking changes to Core 2.0 - remove runtime exceptions Jan 9, 2015

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jan 10, 2015

Member

Is it possible to do this in three batches? I think there are problems in the Graphics part, but not the others.

I believe some of the functions you hid are actually public. See this page for LineStyle, LineCap, LineStyle, and FillStyle.

Member

evancz commented Jan 10, 2015

Is it possible to do this in three batches? I think there are problems in the Graphics part, but not the others.

I believe some of the functions you hid are actually public. See this page for LineStyle, LineCap, LineStyle, and FillStyle.

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jan 10, 2015

Member

Also, don't bump the version number. I prefer to do it with elm-package bump right before a release. This way you always know your reference point when you are changing stuff.

Member

evancz commented Jan 10, 2015

Also, don't bump the version number. I prefer to do it with elm-package bump right before a release. This way you always know your reference point when you are changing stuff.

@deadfoxygrandpa

This comment has been minimized.

Show comment
Hide comment
@deadfoxygrandpa

deadfoxygrandpa Jan 11, 2015

Contributor

Basics has a possible runtime exception:

  function mod(a, b) {
        if (b === 0) {
            throw new Error("Cannot perform mod 0. Division by zero error.");
        }
        var r = a % b;
        var m = a === 0 ? 0 : (b > 0 ? (a >= 0 ? r : r+b) : -mod(-a,-b));

        return m === b ? 0 : m;
  }

Could this return NaN instead?

Contributor

deadfoxygrandpa commented Jan 11, 2015

Basics has a possible runtime exception:

  function mod(a, b) {
        if (b === 0) {
            throw new Error("Cannot perform mod 0. Division by zero error.");
        }
        var r = a % b;
        var m = a === 0 ? 0 : (b > 0 ? (a >= 0 ? r : r+b) : -mod(-a,-b));

        return m === b ? 0 : m;
  }

Could this return NaN instead?

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jan 11, 2015

Member

@deadfoxygrandpa, I don't really know what is the right thing here, but an error sort of feels more correct. I'd be interested if there is a better/faster implementation in general though.

Member

evancz commented Jan 11, 2015

@deadfoxygrandpa, I don't really know what is the right thing here, but an error sort of feels more correct. I'd be interested if there is a better/faster implementation in general though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment