These are chat archives for dry-rb/chat

8th
Feb 2016
Piotr Solnica
@solnic
Feb 08 2016 08:45
@marshall-lee hey buddy, I gave you commit access to dry-types. Feel free to push some simple/obvious fixes/improvements/clean-ups directly to master, otherwise keep sending PRs :) and btw - as I just mentioned in the PR comment, I’ll be doing some refactoring in Type objects, which will simplify internals and make APIs nicer
Vladimir Kochnev
@marshall-lee
Feb 08 2016 09:04
@solnic thanks!
Vladimir Kochnev
@marshall-lee
Feb 08 2016 09:24
@solnic what is the purpose of Type#[]? how should i think of it? is it a constructor or help-me-with-types-problem-operator?
Piotr Solnica
@solnic
Feb 08 2016 10:28
@marshall-lee constructor, although it delegates to the actual constructor that’s injected and may perform additional checks
atm there are 3 interfaces on types, #[], #valid?, and #try
I mean, these 3 deal with an input
there are additional interfaces for building type objects, like #constrained, #default, #optional
I plan to break down Type class into sub-classes
Piotr Solnica
@solnic
Feb 08 2016 10:33
there will be Type::Definition which is, as the name states, just a definition, which includes potential meta-data about a type
then Type::Constructor < Type::Definition will have a constructor
Vladimir Kochnev
@marshall-lee
Feb 08 2016 10:35
@solnic cool but what is the improvement?
Piotr Solnica
@solnic
Feb 08 2016 10:35
and the rest will probably remain as decorators, although I may try to do things like Type::Constrained < Type::Constructor etc
cleaner internals and more flexibility
I esp want to look into sum-types and make sure they work correctly in various scenarios
there will be lots of improvements, ie type definitions won’t be used for constructing values in hashes, which will reduce the call stack
I’d also like to look into making Struct and Value work like Type::Constructor but I’m not yet sure if that’s possible and/or feasible hah
Piotr Solnica
@solnic
Feb 08 2016 10:40
one limitation I’ve hit with Struct is the inability to construct differenet sub-types based on a value from the attributes (kinda like STI in AR)
I’d like to look into that as well
Vladimir Kochnev
@marshall-lee
Feb 08 2016 10:42
@solnic I thought it's possible with constrained types.
where first checked rule is a check of type-tag
Tim Riley
@timriley
Feb 08 2016 10:43

one limitation I’ve hit with Struct is the inability to construct differenet sub-types based on a value from the attributes (kinda like STI in AR)

This would be amaaaaaazing

Piotr Solnica
@solnic
Feb 08 2016 10:43
@timriley yeah, that’s why I want to look into improving/refining Type interfaces
Tim Riley
@timriley
Feb 08 2016 10:43
(well, not the limitation, the surpassing of said limitation)
Piotr Solnica
@solnic
Feb 08 2016 10:44
(right)
Tim Riley
@timriley
Feb 08 2016 10:44
:)
Piotr Solnica
@solnic
Feb 08 2016 10:45
anyhow, gotta finish dry-logic/dry-validation refactorings first :(
@marshall-lee btw if you have any questions/concerns/something seems awkward/stupid/wrong - feel free to let me know, I’m always open to feedback, suggestions, criticism etc