4 ms·
I gotta say I'm quite excited to the refinements to the literal string types.
by jhanschoo 6y ago
I gotta say I'm quite excited to the refinements to the literal string types.
- bmn__ 6y agoI'm not. Look at the ridiculous hoops a programmer must jump through… https://stackoverflow.com/a/63867074 https://stackoverflow.com/a/63867074 … for what is literally a one-liner elsewhere: class User :ro { has name => isa => Str; has email => isa => Str->where('lc =~ /^[a-z.@]{1,32}$/'); } User->new(name => 'Dave Morrison', email => 'Dave.Morrison@gmail.com'); User->new(name => 'Van Morrison', email => 'Van-Morrison@gmail.com'); User->new(name => 'Jim Morrison', email => 'Jim.Morrison.is.my.name.and.it.is.too.long@gmail.com');
- jhanschoo 6y agoYou're comparing a type inference task on a use case it was not meant for against a runtime validation task that you can do in JS as well. It's unfair.