<FromGitter>
<Blacksmoke16> was the example i gave earlier yea
<FromGitter>
<Nicolab> Yes
<FromGitter>
<Nicolab> Thank you very much!
<FromGitter>
<Blacksmoke16> mhm
<FromGitter>
<Nicolab> For the addition of custom validator, if the type is not defined in the lib it's dead. You see a solution to redefine `@@validators = Hash(Symbol | String, ProcTypes).new`? ⏎ Otherwise not too serious, it works, that's the main thing.
<FromGitter>
<Blacksmoke16> thats where the map would come in
<FromGitter>
<Nicolab> I couldn't redefine it when I tested it.
<FromGitter>
<tenebrousedge> `builder.number` seems a little odd. It can't detect the type?
<FromGitter>
<dscottboggs_gitlab> different serialization formats will represent different types in different ways, it seems easier from an implementation standpoint for them to be separate
<FromGitter>
<Blacksmoke16> something like that then maybe?
<FromGitter>
<dscottboggs_gitlab> I guess its the same either way once it compiles so ¯\\_(ツ)_/¯
<FromGitter>
<Blacksmoke16> trying to make things in such a way where the logic is agnostic of the format
<FromGitter>
<tenebrousedge> how many formats are you enabling?
<FromGitter>
<Blacksmoke16> or at least centralized in a type specific to a given format
<FromGitter>
<Blacksmoke16> JSON to start, YAML prob shortly after?
<FromGitter>
<tenebrousedge> abstractions can be tricky. There was a line from HN the other day "two points make a line, but three points usually make a triangle"
<FromGitter>
<Blacksmoke16> would be easier to only have to define two types per format
<FromGitter>
<Blacksmoke16> versus handle probably duplicated logic if you had to reopen types
<FromGitter>
<Blacksmoke16> but how would that work for an array, hmm
<FromGitter>
<Blacksmoke16> because you wouldnt know the type of each value, but each value knows the type it is
<FromGitter>
<tenebrousedge> recursion
<FromGitter>
<tenebrousedge> if it's a primitive of some sort, serialize, if not, recurse
<FromGitter>
<dscottboggs_gitlab> it could be an array of some `Any` union type that implemnts some interface
<FromGitter>
<tenebrousedge> no, that wouldn't work
<FromGitter>
<tenebrousedge> nvm me
<FromGitter>
<dscottboggs_gitlab> something that's come up for me recently, does your serialization library offer a way to format the output in unique ways? For JSON and simpler formats like that, there are relatively few options, but YAML in particular offers a wide array of formatting, and being able to specify formatting rules that are very varied can be important. For example, what if you want a `to_json` method that produces
<FromGitter>
<Nicolab> @Blacksmoke16 ⏎ ⏎ Oh shit! I have finally found a simple solution which get the job done ("Is it possible to dynamically call methods from a module?"). ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5e208885a1dfaa3ba12d276d]
<FromGitter>
<Blacksmoke16> whats the point of the macro?
<FromGitter>
<Blacksmoke16> which will be fine for your `validate` macro
<FromGitter>
<Blacksmoke16> yea
<FromGitter>
<Blacksmoke16> > dynamically call methods withe the rule name ⏎ ⏎ I assuming you're going to add more logic to the `run` macro?
<FromGitter>
<Blacksmoke16> like why not just do `add 1,2` or `hello "foo"`
<FromGitter>
<Nicolab> Hmm good catch
<FromGitter>
<Blacksmoke16> mhm, because in reality you're not dynamically calling them (since the method names are hard coded)
<FromGitter>
<Blacksmoke16> in order to truly call them dynamically i think you would have to have to do like
<FromGitter>
<Nicolab> > I assuming you're going to add more logic to the run macro? ⏎ Originally I wanted to put out the macro but it's falling apart.
<FromGitter>
<Blacksmoke16> @j8r / @straight-shoota whats the diff between `ci-test-dev-alpine` and `ci-test-dev-alpine-build`?
ur5us has joined #crystal-lang
<FromGitter>
<Blacksmoke16> latter used meant to be used for building static binaries?
<FromGitter>
<nothratal> Hello together
<FromGitter>
<nothratal> I know how to overload methods, I also know how to "extend" classes (just by defining a class with the same name and adding methods) but can I also do this for structs? ⏎ Short: Extend built-in structs?
<FromGitter>
<christopherzimmerman> Yes, you can. I do it for numbers so that I can override arithmetic with custom types.
<FromGitter>
<christopherzimmerman> One problem that you might be running into is trying to extend the types inside a module, which doesn't work AFAIK, since it will treat it as a different type.
<FromGitter>
<tenebrousedge> not sure how you tried to do that, but it should be possible
<FromGitter>
<nothratal> this also works on abstract structs? like Number?
<FromGitter>
<Blacksmoke16> yes, and would be available on its children
Nicolab has joined #crystal-lang
<FromGitter>
<craysiii> Good day everyone, is it possible to hook into an on_open event for HTTP::Websocket? I’m trying to port over a rubygem I wrote which relies on eventmachine and faye/websocket, and I rely on on_open
<FromGitter>
<Nicolab> @craysiii Seems to me there's no on_open in the HTTP::Websocket implementation
<FromGitter>
<Nicolab> Maybe in a lower level (to the socket module)
<FromGitter>
<tenebrousedge> you could maybe override `run`, throw your event, and call `super`
<FromGitter>
<Blacksmoke16> ah, yea seems how crystal does it
<FromGitter>
<tenebrousedge> similar, maybe more restrictive
<FromGitter>
<Blacksmoke16> granted in crystal you cant splat arrays/hashes anyway
ur5us has joined #crystal-lang
<FromGitter>
<tenebrousedge> > Deprecations ⏎ $; and $, global variables (Perl ancestry: default split and join separators):
<FromGitter>
<tenebrousedge> thank goodness
<FromGitter>
<tenebrousedge> I felt bad about even knowing they existed
ht_ has quit [Remote host closed the connection]
<FromGitter>
<tenebrousedge> but they're keeping the flip-flop notation. huh.
<FromGitter>
<tenebrousedge> > “Safe” and “taint” concepts are deprecated in general
<FromGitter>
<tenebrousedge> > Calling a private method with a literal self as the receiver is now allowed.
<FromGitter>
<tenebrousedge> good changes
<FromGitter>
<tenebrousedge> Refinements and the `method` method play nice now, excellent
<FromGitter>
<tenebrousedge> and `irb` is now shinier and more like `pry`
duane has quit [Ping timeout: 268 seconds]
<FromGitter>
<straight-shoota> @Blacksmoke16 It's the same as with the Ubuntu-based Docker images. `-build` images contains the necessary libraries for building the compiler, that is, primarily LLVM.
yukai has joined #crystal-lang
martinium has joined #crystal-lang
martinium has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]