GithubHelp home page GithubHelp logo

moox-types-mooselike's People

Contributors

arcanez avatar bobtfish avatar dolmen avatar dsteinbrunner avatar haarg avatar mateu avatar meamidos avatar shadowcat-mst avatar sineswiper avatar skaufman-socialflow avatar tobyink avatar wchristian avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

moox-types-mooselike's Issues

Str accepts undef?

The Str type isn't validated for undef so it is accepted. It shouldn't.

This is what happens when you try to give undef to an Str type in Moose:

Validation failed for 'Str' with value undef

Parameterized types screw up Moo's "required"

When using parameterized types, suddenly Moo's "required" check doesn't work anymore.
Sample code follows.

This errors out correctly:

{
  package MyObject;
  use Moo;
  use MooX::Types::MooseLike::Base qw<HashRef>;
  has attr => ( is => "ro", isa => HashRef, required => 1 );
}
MyObject->new();

# Missing required arguments: attr at (eval 19) line 31.

This, however, doesn't crash at all.

{
  package MyObject;
  use Moo;
  use MooX::Types::MooseLike::Base qw<HashRef>;
  has attr => ( is => "ro", isa => HashRef[HashRef], required => 1 ); # <- here is the change
}
MyObject->new();

Do you have plan to support enum?

Moose::Util::TypeConstraints has enum(\@values) function to support.
Does this module have a plan to support replacement for this style type?

No proper handling of uninitialized parameters

The code:

Num->(undef)

Yields the following error:

Use of uninitialized value $_[0] in concatenation (.) or string at /home/sawyer/perl5/lib/perl5/MooX/Types/MooseLike/Base.pm line 64.

Parametrized checks for subtypes

MooX/Types/MooseLike.pm, line 52
A new $test coderef is declared, which handles type check both for parent-type and subtype. Initial shift in this coderef is stored in $value and passed to test functions, both parent and child. The problem is when you have a type that has a subtype_of field and uses a parameter. The parameter will then never get passed to the test function, making it impossible to implement any type with a parameter that is a subtype of something.

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.