<hightower2>
Hey help me with the syntax a little bit here. So, let's say I have "action" which is an instance of Proc(Event,Nil). And I have Wrapper(T). How would I instantiate this Wrapper(Proc(Event,Nil)) ?
<FromGitter>
<Blacksmoke16> assuming the initialize is like `@action : T`?
<hightower2>
yes, good enough. And there are 2 other params
<hightower2>
Blacksmoke16 Absolutely fantastic, the double proc trick worked, I finally figured it out. Now just checking why isolated examples work, while something as part of existing tests causes an error...
snsei has joined #crystal-lang
<FromGitter>
<watzon> Starting to write bindings to freetype2. Fuck this has a lot in it.
<FromGitter>
<watzon> Can't even use libgen on it because of the way they structure imports
<FromGitter>
<christopherzimmerman> I have a few training atm, unfortunately it doesn't support GPU training, but they still should be done in the next day or so.
<FromGitter>
<watzon> I agree there. We'd just need to find some good datasets and put in the time to do some training
<FromGitter>
<watzon> My computer wouldn't be any good for GPU training anyway
<FromGitter>
<watzon> What kinds of sets are you working on?
<FromGitter>
<christopherzimmerman> Just facial recognition for now
<FromGitter>
<christopherzimmerman> That's one of the most popular for research.
<FromGitter>
<christopherzimmerman> I think the ideal goal is: host a few popular ones ourselves, and maintain a curated list of user sourced models as well.
snsei has quit [Ping timeout: 252 seconds]
<FromGitter>
<watzon> Yeah I was gonna suggest it
<FromGitter>
<watzon> I'm working on bindings to libfreetype as well so we can get font rendering
<FromGitter>
<christopherzimmerman> Thats what I thought. It throws `no overload matches 'Bottle::Tensor(T).from_proc' with types Array(Int32), Proc(Int32, Float64)`
<FromGitter>
<Blacksmoke16> what are you giving it?
<FromGitter>
<watzon> And I'm not even all the way through
duane has quit [Remote host closed the connection]
snsei has joined #crystal-lang
f1refly has quit [Ping timeout: 250 seconds]
f1reflyylmao has joined #crystal-lang
ur5us has quit [Ping timeout: 250 seconds]
snsei has quit [Ping timeout: 240 seconds]
snsei has joined #crystal-lang
snsei has quit []
<FromGitter>
<phangs> @Blacksmoke16 thank you got the code working with just probably minor issue. I left another reply in the blog's comment. thank you very much
ht_ has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
gangstacat has quit [Ping timeout: 250 seconds]
dwdv has joined #crystal-lang
gangstacat has joined #crystal-lang
_whitelogger has joined #crystal-lang
ur5us has quit [Ping timeout: 250 seconds]
alexherbo2 has joined #crystal-lang
HumanGeek has joined #crystal-lang
return0__ has joined #crystal-lang
justinmcp_ has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
return0e_ has quit [Read error: Connection reset by peer]
justinmcp has quit [Quit: No Ping reply in 180 seconds.]
<FromGitter>
<asterite> @Blacksmoke16 yes, it's expected. The first time `Value` is the implicit supertype. Similar to how when you don't specify it with `class` it's `Reference`
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo2 has joined #crystal-lang
DTZUZO has quit [Ping timeout: 240 seconds]
<FromGitter>
<Blacksmoke16> π
DTZUZO has joined #crystal-lang
<FromGitter>
<Blacksmoke16> @phangs thanks, I pushed a fix for the log file issue, forgot a line
<FromGitter>
<Blacksmoke16> the other issue is saying that the database doesn't have a table called `users`
<FromGitter>
<tenebrousedge> does crystal optimize away instance variables? I'm getting the impression from llvm-ir that these things produce the same instructions: β β ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ddbd70d1bf5192e66a0a2ca]
<FromGitter>
<yxhuvud> Eh, those are not instance variables.
<FromGitter>
<tenebrousedge> well, yes, but this is my pre-coffee brain
<FromGitter>
<tenebrousedge> local variables, then
hightower4 has joined #crystal-lang
<hightower4>
It's funny that active_record.cr does not come up in search on either crystalshards.org or crystalshards.xyz, yet it certainly exists - https://github.com/waterlink/active_record.cr
<FromGitter>
<Blacksmoke16> id be surprised if it still works
<hightower4>
yeah I saw last commit ages ago
<hightower4>
Just btw, how would one specify the minimum crystal version required to run a shard?
<FromGitter>
<didactic-drunk> @hightower4 Without a `crystal` project tag active_record.cr won't show on crystalshards.
duane has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 252 seconds]
<FromGitter>
<Fryguy> @didactic-drunk Is that a recent change? I know a while ago I had a number of personal projects show up there even without the tag (though i don't see them now)
<FromGitter>
<Fryguy> actually now that I check, even my projects that have the crystal tag are not there
<FromGitter>
<didactic-drunk> crystalshards has `where updated > 1.year.ago` in it's github search query which hides lots of old projects.
<FromGitter>
<manveru> is there a way to do: `def a(*args : String); b(*(["bar"] + args.to_a)); end; def b(*args) ...; end; a "one", "two"`?
<FromGitter>
<tenebrousedge> hmm, that's a thing too
<hightower4>
didactic-drunk oooh, I thought it selected projects based on them being recognized as written in crystal language
<hightower4>
Blacksmoke16 re. /SPEC.md#crystal , yes, yes, but you see it says it is the "The last known Crystal version that is capable to compile the Shard (String).". It doesn't define a way to set minimum required version
<FromGitter>
<Daniel-Worrall> It's "latest known", so not minimum, but I find Crystal in its prerelease form is always in a state of updating. Closer to release, it'll be a much more useful parameter
hpyc9 has joined #crystal-lang
<FromGitter>
<Blacksmoke16> Wouldn't that be essentially the same thing
<FromGitter>
<Blacksmoke16> Minimum version required would also be the last one required to compile the shard
<FromGitter>
<Daniel-Worrall> Say my app compiles on 29,30,31. Latest supported is 31. Minimum is 29
<FromGitter>
<Daniel-Worrall> Like how ruby can specify a minimum version with bundler
<FromGitter>
<wontruefree> @hightower4 did you run Chicago Ruby back in the day?
<FromGitter>
<straight-shoota> @Daniel-Worrall Minimum Crystal version is not much relevant, because it is usually expected to use a rather current Crystal compiler.
HumanGeek has quit [Ping timeout: 252 seconds]
Raimondi has quit [Quit: WeeChat 2.5: Β‘Chau!]
<FromGitter>
<straight-shoota> That's different in Ruby, where the interpreter is a runtime dependency, which leads to far wider version distribution. Crystal apps need the compiler only to build the software, not to execute them. This makes it much easier to always use the latest release.
Raimondi has joined #crystal-lang
ht_ has joined #crystal-lang
<FromGitter>
<Daniel-Worrall> hightower4 ^
<hightower4>
wontruefree wish that I did :) I'm in Europe
<hightower4>
mm, yes, but I think this "last known to work" which the current field 'crystal' signifies is kind of not the same thing. Because I think the version there affects the version with which Travis will compile the shard, right?
<hightower4>
so people keep bumping this to latest version, and the info about minimum version required is lost
<FromGitter>
<straight-shoota> > Because I think the version there affects the version with which Travis will compile the shard, right?
<FromGitter>
<straight-shoota> It should not.
<FromGitter>
<straight-shoota> > so people keep bumping this to latest version, and the info about minimum version required is lost β β That's how it's intended.
<FromGitter>
<Daniel-Worrall> The only thing I know which uses the crystal version like that is crenv, not travis.
<FromGitter>
<straight-shoota> travis should always use latest crystal
<hightower4>
ok, great, thanks for clarifications
<hightower4>
Well, OK. I think knowing a minimum version would be useful without trying to compile the project to find out (and possibly not finding out even then, in the case that the difference doesn't cause a compile error)
<hightower4>
maybe it's not important now when everyone just wants/needs to use latest anyway
<FromGitter>
<straight-shoota> What would be the use case for compiling with a non-recent compiler release?
<hightower4>
Well say you have a program which you want to use, and it works, but the only requirement is that you compile with compler <= some version.
<hightower4>
compiler*
<hightower4>
so you don't see this requirement anyway, can't guess why the compile is failing, and don't know which version to use instead, other than assuming it's due to compiler changes and trying one by one backwards
<FromGitter>
<straight-shoota> The only reason for that would be that an other dependency doesn't compile with a current release.
<hightower4>
ok
<hightower4>
well, maybe if a shard or program stop being updated at some point, then also their crystal: field in shard.yml won't be updated either
<hightower4>
so someone who wants to use it after a couple years will be able to refer to the version that's there
<hightower4>
ok, makes sense, thanks
<FromGitter>
<straight-shoota> Exactly. That's why we keep track of the latest supported version.
alexherbo2 has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
<FromGitter>
<Blacksmoke16> anyone know the default HTTP::Client timeout amount?
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
<hightower4>
Seems like 5 minutes?
<hightower4>
or no default?
<FromGitter>
<Blacksmoke16> yea seems to be a few min
<hightower4>
it appears timeout is allowed to be nil and falls back to any default in libevent, or maybe even no default/no timeout?
<FromGitter>
<Blacksmoke16> proxy thing is a blocker for a little test project i had going at work :sad:
<FromGitter>
<Blacksmoke16> might see if i can get that example working, seems quite old
<hightower4>
That double-proc trick keeps causing me issues. First was, my idea with events was that, if you register an event with "on SomeEvent, myhandler", you can also remove it with "off SomeEvent, myhandler".
<hightower4>
Now this doesn't work because when double-proc implicitly gets created, the code which goes over the list of handlers searching for handler==myhandler no longer matches anything (because the handler in the list is double-proc, not the original handler)
<hightower4>
So I solved this issue by not doing comparison of handler==myhandler, but comparing stored handler.hash (the original one) with the supplied myhandler.hash
<hightower4>
But I have a different error now, now wherever I
<hightower4>
n/m, too complex to describe... need to stare more
<FromGitter>
<manveru> does anyone by chance have a GeoJSON type around? :)
sagax has quit [Ping timeout: 240 seconds]
<FromGitter>
<kinxer> @manveru I have a non-public library for parsing and handling GeoJSON that I intend to put on GitHub soon (TM). If someone would actually use it, I'll make it more of a priority.
<FromGitter>
<manveru> that'd be awesome, yeah
<FromGitter>
<manveru> atm i have a half-assed class for it, but i'd like to properly handle it
<FromGitter>
<kinxer> I have a pretty complete implementation, so hopefully it'll be able to provide what you need.
<hightower4>
Is #hash a quick operation? Does it compute something or just assigns unique ID?
<FromGitter>
<tenebrousedge> `[1]` hashes to the same value as `[1]`
<FromGitter>
<tenebrousedge> `nil` hashes to `0` always
<FromGitter>
<tenebrousedge> some objects override `hash` for comparison purposes
<hightower4>
ok, as long as it's not being actually computed in runtime it works for me regardless of how it works. But how do we explain the behavior from this last example on play?
<FromGitter>
<tenebrousedge> well, it is computed at runtime
<hightower4>
right, yes, but at object creation, not when calling #hash, right?
<FromGitter>
<tenebrousedge> yes
<hightower4>
actually, oh boy, it seems it changes, check this:
<hightower4>
ok it's clear that if some classes override it for comparison purposes, then as elements are added to array looks reasonable the hash will change
<FromGitter>
<tenebrousedge> yes
<FromGitter>
<Daniel-Worrall> Did some testing. Arrays hash are the same when the values are the same regardless of instancing
<hightower4>
ok speed-wise it appears calling array.hash is equally fast as array.size, so I would conclude no particular time is wasted when calling #hash
<FromGitter>
<Daniel-Worrall> It was posted on the reddit recently
<FromGitter>
<watzon> Nice!
commavir has quit [Ping timeout: 245 seconds]
commavir has joined #crystal-lang
ht_ has quit [Quit: ht_]
ur5us has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
<FromGitter>
<jwoertink> I have a shard that has a bunch of stuff in it's spec directory that I'd like to use in other projects. Is there a way to require stuff from a shard's spec directory?
<FromGitter>
<jwoertink> Or is it just better to move that in to the library?
<FromGitter>
<tenebrousedge> that second one seems like a better idea
<FromGitter>
<jwoertink> Yeah. I was trying to avoid putting all the spec related stuff in the main lib, but it seems like that's my best option
ur5us has joined #crystal-lang
<FromGitter>
<wontruefree> just a little reminder but @asterite is speaking at Chicago Crystal next week chicagocrystal.org/events/bbhsjryzqbhb/
<FromGitter>
<kinxer> @jwoertink Do you only want to use it in the projects that already require that lib?
<FromGitter>
<jwoertink> Yeah
<FromGitter>
<Daniel-Worrall> @jwoertink You could require relatively to the spec file like `require "../lib/my_lib/spec/spec_file"`
<FromGitter>
<watzon> Was just about to say that haha
<FromGitter>
<Daniel-Worrall> or uh, use *DIR*?
<FromGitter>
<jwoertink> haha let me try that
<FromGitter>
<Daniel-Worrall> I'd only recommend it for your own personal stuff, and not something you expect a user to do
<FromGitter>
<Daniel-Worrall> it's pretty janky
<FromGitter>
<kinxer> I think it's probably still cleaner to move that stuff to the main shard, create a new shard for it, or not use those things and instead stick with the shard API you already have set up.
<FromGitter>
<Daniel-Worrall> Oh, definitely
<FromGitter>
<Daniel-Worrall> sometimes you just wanna say fuck it and use bad code
<FromGitter>
<tenebrousedge> D:
<FromGitter>
<kinxer> Or you just can't spare the up-front time to make it good code.
<FromGitter>
<tenebrousedge> I've never, ever used or written bad code. I tell no lies <___<
<FromGitter>
<kinxer> XD
<FromGitter>
<Daniel-Worrall> that's the usual cause of bad code
<FromGitter>
<jwoertink> Well, it's all shared code. In Lucky there's these objects called Boxes which is like a factory object for specs
<hightower4>
Is there a way to reopen a class without knowing what it inherited from? Like, once it's defined with "class X < Something", is there a way to reopen "class X" without knowing "Something" ?
<FromGitter>
<jwoertink> Boxes live in the spec directory. But I want to use the Boxes in the shard in the projects that require that shard
<FromGitter>
<jwoertink> Ok, so it looks like just doing the literal path works
HumanG33k has quit [Remote host closed the connection]
<FromGitter>
<straight-shoota> @jwoertink I'd just put the reusable spec supports in `src/spec` and require them using `shard_name/spec` from other shard's spec suite
<FromGitter>
<straight-shoota> @lbarasti done, waiting for CI to give green light
<FromGitter>
<manveru> so i'm just digging into JSON parsing... is there a way to parse a `[{"type": "A", "x": 1},{"type":"B","y":2}]` to correct types based on the `type`s value?
<FromGitter>
<Blacksmoke16> @manveru in `0.32.0` there will be yes