ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
sorcus has quit [Ping timeout: 252 seconds]
_whitelogger has joined #crystal-lang
alex`` has quit [Ping timeout: 268 seconds]
ashirase has quit [Quit: ZNC - http://znc.in]
dingenskirchen has quit [Ping timeout: 272 seconds]
<FromGitter> <watzon> Anyone have a good idea for how to go about connecting to a IPC socket like https://mpv.io/manual/stable/#json-ipc and pass messages back and forth?
<FromGitter> <watzon> I know @Papierkorb has a json-rpc library, but it doesn't say how to connect to a socket specifically and it hasn't been updated for a while so I'm not sure if it will work anyway.
<FromGitter> <watzon> Well I didn't know this existed https://crystal-lang.org/api/0.30.0/UNIXSocket.html lol
<FromGitter> <watzon> Might help
laaron has joined #crystal-lang
<FromGitter> <watzon> Started working on yet another side project Tidal.cr (https://github.com/watzon/tidal.cr)
<FromGitter> <watzon> Just got Tidal and I want a working terminal client for it, so...
<FromGitter> <galvertez> i have a question about array behavior - i was surprised to learn that i can include `module M` in `class C` and then add an instance of `C` to a `[] of M` with no problem. that is, the memory footprint of `class C` could be different from `class G` even if they both include `M`
<FromGitter> <galvertez> and i thought the reason for the type restriction for generic arrays was mainly about predictable memory formats since array uses pointers
<FromGitter> <galvertez> but given that i was able to do it, it kind of seems like it is more about predictable behavior of the array's entries (i.e. we know that all members will respond to the methods defined in `M`)
<FromGitter> <galvertez> i guess this is more a question about pointers in crystal rather than arrays :)
<FromGitter> <galvertez> oh @watzon actually i've been working on a json rpc lib as well... it's not quite working yet but should be soon - i am specifically designing it to be transport agnostic so you that anyone can use whatever socket they like
<FromGitter> <galvertez> idk if that would help but it might mean less hacking around somebody else's library
<FromGitter> <galvertez> if it was working <_<
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <galvertez> i've been distracted writing up a shard that implements a layer 6 (maybe layer 7... OSI gets kinda murky above layer 4) protocol for this https://raft.github.io/ because i wanted to learn more about `IO`
<FromGitter> <galvertez> but if it would be helpful for you to have a working jsonrpc lib i could change gears and get back to that
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <watzon> Turns out I don't really need jsonrpc, just normal text based rpc
ht_ has joined #crystal-lang
go|dfish has quit [Ping timeout: 248 seconds]
ht_ has quit [Quit: ht_]
<FromGitter> <kingsleyh> @galvertez I wonder if Raft might be incorporated into my Blockchain platform - https://SushiChain.io
<FromGitter> <watzon> That would be pretty cool
moei has joined #crystal-lang
<FromGitter> <rishavs> Wonder what the community thinks about Artichoke. https://github.com/artichoke/artichoke ⏎ Its essentially a Ruby compiler written in Rust.
<FromGitter> <watzon> I just saw that earlier actually
<FromGitter> <watzon> Looks pretty cool
<FromGitter> <bew> @watzon tidal looks good! Fwiw I'm fond of mpv, did some ipc with it in shell (note: writing json in shell is ugly), I'd love to see what you come up with using crystal ;)
<FromGitter> <watzon> So far writing a wrapper for mpv is proving to be a pain in the ass, but I'm still working at it lol
<FromGitter> <watzon> Anything event based in Crystal kinda sucks
<FromGitter> <bew> Is it? Do you want a full wrapper and make your own player on top? Or just feed it a url and let it do its thing? (using mpv's cli interface)
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
<FromGitter> <watzon> I'm trying to wrap a portion of it. I eventually want to have a curses front end, so I need the ability to play/pause/stop, change tracks, keep track of the play position, etc.
<FromGitter> <watzon> Right now I'm doing this inside of the tidal.cr project, but I think I'll put it in its own shard and just attempt a full wrapper.
laaron has joined #crystal-lang
<FromGitter> <watzon> The problem is just listening for events. It's so easy in node because of EventEmitter.
<FromGitter> <bew> True, but EventEmitter is pretty simple to recreate iirc
<FromGitter> <bew> Good luck with the wrapper, please tell me what you have a poc of it if you want another pair of eyes on it ;)
<FromGitter> <absolutejam_gitlab> `created_at: { type: Time, converter: Time::Format }`
<FromGitter> <absolutejam_gitlab> In my `JSON.mapping`
<FromGitter> <absolutejam_gitlab> Should that work?
<FromGitter> <absolutejam_gitlab> ` "created_at":"2019-01-03T01:56:19.539Z",`
<FromGitter> <absolutejam_gitlab> Is the data
alex`` has joined #crystal-lang
flaviodesousa has joined #crystal-lang
<FromGitter> <watzon> @bew the hard part about EventEmitter is allowing any type to be emitted. I've contributed a lot to @hugoabonizio's EventEmitter library, but it's still hard to get to the same level that Node is πŸ€·πŸΌβ€β™‚οΈ
<FromGitter> <watzon> @absolutejam_gitlab Time::Format isn't a converter so no
<FromGitter> <watzon> You either would have to use one of the built in Time converters or roll your own
<FromGitter> <absolutejam_gitlab> Defines `to_json` and `from_json` - Isn't that enough?
<FromGitter> <absolutejam_gitlab> It's an example too
<FromGitter> <absolutejam_gitlab> > converter: specify an alternate type for parsing and generation. The converter must define from_json(JSON::PullParser) and to_json(value, JSON::Builder) as class methods. Examples of converters are Time::Format and Time::EpochConverter for Time.
<FromGitter> <watzon> I mean you can try it, but I don't think it will work
<chachasmooth> I get the following new error since i upgraded kemal from 0.25.2 to 0.26.0: Error in ...: instantiating 'Kemal::ParamParser#url()' id = env.params.url["id"]
<chachasmooth> how to fix that?
<FromGitter> <watzon> @chachasmooth I'd try the Kemal gitter channel
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
flaviodesousa has quit [Ping timeout: 246 seconds]
flaviodesousa has joined #crystal-lang
<FromGitter> <j8r> lol @asterite is back to the organization https://github.com/orgs/crystal-lang/people . One question remains - for how long :trollface: ?
go|dfish has joined #crystal-lang
<FromGitter> <bew> @watzon there's also this one that I prefer because you can pass any args and it's type safe https://github.com/Papierkorb/cute
dingenskirchen has joined #crystal-lang
<FromGitter> <watzon> Yeah I've used that before, just not the biggest fan of the implementation. It may be the best way to do it in Crystal though.
<FromGitter> <straight-shoota> @j8r He's always been a member, just not public
Sithembewena has joined #crystal-lang
_whitelogger has joined #crystal-lang
sorcus has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> Hm, is it normal for `ARGV` to represent `foo bar "foo bar baz"` as `["foo", "bar", "foo", "bar", "baz"]`
<FromGitter> <tenebrousedge> hmm, probably not
<FromGitter> <tenebrousedge> does it do the same thing with single quotes?
<FromGitter> <naqvis> They don’t take into account the quotations, so always have to do a manual hack around them
<FromGitter> <tenebrousedge> I would call that a bug
<FromGitter> <naqvis> I would say it should be treated as bug, same applies to `String#split` and well as `csv` module.
<FromGitter> <absolutejam_gitlab> Going to have to figure a way around this
<FromGitter> <absolutejam_gitlab> It's breaking my CLI parsing
<FromGitter> <tenebrousedge> `String#split` is buggy?
<FromGitter> <naqvis> yes it is @tenebrousedge
<FromGitter> <naqvis> for James Booth scenario, it would have ended up in same results
<FromGitter> <tenebrousedge> @naqvis could you explain?
<FromGitter> <tenebrousedge> huh
<FromGitter> <absolutejam_gitlab> Is there a way to get `ARGV` as a string?
<FromGitter> <absolutejam_gitlab> Otherwise I'm going to have to look for `--` and that's a bit gross
<FromGitter> <naqvis> you can invoke `to_s` method
<FromGitter> <absolutejam_gitlab> but that won't preserve the quotes?
<FromGitter> <naqvis> and that will return Array of String
<FromGitter> <naqvis> it does
<FromGitter> <absolutejam_gitlab> It preserves quotes around each string
<FromGitter> <naqvis> ```crystal run test.cr -- A B C "D E F” # => "[\"A\", \"B\", \"C\", \"D E F\”]”``` [https://gitter.im/crystal-lang/crystal?at=5d481bae4b8ca519c9eb8d69]
<FromGitter> <absolutejam_gitlab> Mine's not giving that
<FromGitter> <absolutejam_gitlab> hm, wonder if it's how I'm calling crystal run
<FromGitter> <tenebrousedge> the `--` might be important
<FromGitter> <absolutejam_gitlab> I use a shell script that does `crystal run src/foo/foo.cr -- ${@}`
<FromGitter> <naqvis> yeah it is if you invoke `crystan run`
<FromGitter> <absolutejam_gitlab> That may be the culprit
<FromGitter> <naqvis> or else `crystal` will take arguments as input file
<FromGitter> <naqvis> `β€”` is to tell crystal, what follows is just input to file what you are running
<FromGitter> <absolutejam_gitlab> `"${@}"`
<FromGitter> <absolutejam_gitlab> There we go
<FromGitter> <absolutejam_gitlab> just going to build it and see if it's the same for the binary
<FromGitter> <naqvis> if you run the binary, you don’t need to use --
<FromGitter> <naqvis> as what follows after binary will be considered as arguments to file
<FromGitter> <absolutejam_gitlab> Yeah, I know, but I've been using a shell script that emulates the binary
<FromGitter> <absolutejam_gitlab> so I can do `./run foo bar baz`
<FromGitter> <naqvis> aha, then you have :)
<FromGitter> <naqvis> @tenebrousedge ⏎ ⏎ ```a =<<-X ⏎ Foo Bar "Baz Bar" ⏎ X ⏎ ⏎ pp a.split(" β€œ) # => ["Foo", "Bar", "\"Baz", "Bar\”"]``` [https://gitter.im/crystal-lang/crystal?at=5d481dd23d8f1f29e0169678]
<FromGitter> <tenebrousedge> that looks correct
<FromGitter> <tenebrousedge> @naqvis I don't know what else you would expect `split` to do; JS and Ruby work the same way
<FromGitter> <absolutejam_gitlab> Yeah, that's right
<FromGitter> <absolutejam_gitlab> It does exactly what it says on the string
<FromGitter> <absolutejam_gitlab> The ARGV one threw me off because that should be a shell feature
<FromGitter> <tenebrousedge> the rule with shell scripting is, "always quote variables"
<FromGitter> <tenebrousedge> the other rule with shell scripting is, "try not to write shell scripts"
<FromGitter> <absolutejam_gitlab> Aint nothing wrong with shell scripts
<FromGitter> <tenebrousedge> except that Bash lacks basic features present in all other scripting languages
<FromGitter> <tenebrousedge> named arguments, classes, types
<FromGitter> <tenebrousedge> even `test` is an external command
<FromGitter> <tenebrousedge> `[[` is a program with a required last argument of `]]`
<FromGitter> <tenebrousedge> if bash didn't exist, and you came up with a language with those characteristics and tried to market it, people would call you nuts
<FromGitter> <naqvis> > that looks correct ⏎ ⏎ I was expecting `#split` to preserve the quotes, as does Go
<FromGitter> <tenebrousedge> it does
<FromGitter> <tenebrousedge> `"\"Baz"`
<FromGitter> <naqvis> i mean, `#split` should have ended up with size of 3 instead of 4
<FromGitter> <naqvis> `”Baz Bar”` should have been treated single entity
<FromGitter> <tenebrousedge> why? there's a space in there
<FromGitter> <naqvis> shouldn’t be spliting on the `delimiter` inside quotes
<FromGitter> <tenebrousedge> yes it should. It's splitting, not parsing
<FromGitter> <naqvis> its similar behavior to how `CSV` parser does
<FromGitter> <naqvis> commands inside quotes aren’t treated as separator
<FromGitter> <tenebrousedge> CSV is parsed, `split` is not a parser
<FromGitter> <naqvis> i’m talking about the behavior
<FromGitter> <naqvis> not about the implementation details
<FromGitter> <tenebrousedge> right, `split` is not and should not be content-aware
<FromGitter> <tenebrousedge> if Go works differently, it's probably alone in doing that
<FromGitter> <tenebrousedge> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d4823d341d5cd61b5ba5e3d]
<FromGitter> <tenebrousedge> prints ⏎ ⏎ ```["foo" "bar" "\"baz" "qux\""]``` [https://gitter.im/crystal-lang/crystal?at=5d4823eb75c7976e03301dd8]
return0e has quit [Ping timeout: 245 seconds]
<FromGitter> <tenebrousedge> ditto with `\`foo bar "baz quz"\``
<FromGitter> <naqvis> Thanks @tenebrousedge . interesting enough, I might have got defeated by utilizing the %v to print the output.
<FromGitter> <tenebrousedge> yes, it could certainly be clearer. It would be nice if golang had `pp`
<FromGitter> <naqvis> yeah agree ⏎ ⏎ ```fmt.Printf("%v\n",strings.Split("Foo Bar \"Baz Bar\"", " β€œ)) # => [Foo Bar "Baz Bar”]``` [https://gitter.im/crystal-lang/crystal?at=5d48258bd7fc954750030099]
<FromGitter> <tenebrousedge> there is an external lib (https://godoc.org/github.com/kr/pretty)
<FromGitter> <naqvis> πŸ‘
<FromGitter> <naqvis> @tenebrousedge Thank you
<FromGitter> <naqvis> @tenebrousedge Thank you
<FromGitter> <naqvis> πŸ‘
<FromGitter> <tenebrousedge> 😊 you are quite welcome
return0e has joined #crystal-lang
<FromGitter> <rogerwelin_gitlab> Hi all, crystal newbie here, I have a question about json parsing. The problem is that when the json keys have leading capital letter the json mapping wont work: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Any ideas how to fix this? =) [https://gitter.im/crystal-lang/crystal?at=5d4828aa4b8ca519c9ebe898]
<FromGitter> <naqvis> Variables name need to start with lowercase. If you have different keys then variables then use `type` instead
<FromGitter> <tenebrousedge> ^
<FromGitter> <naqvis> ```class Item ⏎ JSON.mapping( ⏎ name: {type: String, key: β€œName”} ⏎ ) ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5d48290bee80d76164f17913]
<FromGitter> <rogerwelin_gitlab> @naqvis thx! obvious now that I see it, quite similar to Go
<FromGitter> <naqvis> ywc
duane has joined #crystal-lang
<FromGitter> <Blacksmoke16> might be able to use a converter to downcase the key names for you
<FromGitter> <Blacksmoke16> if you're not able to easily change the input josn
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
woodruffw has quit [Ping timeout: 245 seconds]
woodruffw has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
woodruffw has quit [Ping timeout: 244 seconds]
woodruffw has joined #crystal-lang
lucasb has joined #crystal-lang
<FromGitter> <absolutejam_gitlab> Wait, what
<FromGitter> <absolutejam_gitlab> `type must be Array(Bool | Int32 | String), not Array(String)`
Sithembewena has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <Blacksmoke16> they arent the same type
<FromGitter> <Blacksmoke16> so yea
<FromGitter> <absolutejam_gitlab> But it's a union, so in my mind, that should pass?
<FromGitter> <tenebrousedge> you can reduce them to the same type
<FromGitter> <Blacksmoke16> but the latter one is not a union
<FromGitter> <tenebrousedge> array.as(Array(String))
<FromGitter> <ArtLinkov> Anybody here has experience with 'mysql' in crystal?
<FromGitter> <ArtLinkov> I'm having trouble reading back a query and the documentation is a bit slim
<FromGitter> <Blacksmoke16> got some example code and the error?
<FromGitter> <ArtLinkov> Yes
<FromGitter> <absolutejam_gitlab> I'm using a type alias
<FromGitter> <absolutejam_gitlab> so I guess
<FromGitter> <absolutejam_gitlab> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d483a9445da450fecadba2b]
<FromGitter> <absolutejam_gitlab> Basically what it equates to
<FromGitter> <Blacksmoke16> just have to make sure the array you're passing in is also of the same type
<FromGitter> <tenebrousedge> it's not usually necessary to restrict the type of your args though
<FromGitter> <Blacksmoke16> i always do
<FromGitter> <absolutejam_gitlab> Yeah, I prefer to
<FromGitter> <absolutejam_gitlab> if I do `tokens.clear.as(Array(Token))` it works
<FromGitter> <absolutejam_gitlab> That seems really iffy to me
<FromGitter> <Blacksmoke16> i mean it makes sense
<FromGitter> <Blacksmoke16> if you try to pass `["foo"]` to that method its not going to work
<FromGitter> <Blacksmoke16> because as it is, its type is `Array(String)`
<FromGitter> <absolutejam_gitlab> But it's the return type that's failing
<FromGitter> <Blacksmoke16> oh
<FromGitter> <absolutejam_gitlab> Sorry, I didn't make that clear
<FromGitter> <tenebrousedge> what type is it?
<FromGitter> <tenebrousedge> before the cast
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
<FromGitter> <absolutejam_gitlab> well, in that example it should be the same because I only did `tokens.clear`
<FromGitter> <absolutejam_gitlab> In another, similar method, I *may* have ended up with only `Array(String)`
<FromGitter> <Blacksmoke16> its similar to what i was talking about
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/7cv2
<FromGitter> <Blacksmoke16> works fine if the original array has all three types
<FromGitter> <tenebrousedge> having only strings in the array would not necessarily make the type `Array(String)`
<FromGitter> <tenebrousedge> if it was passed in as `Array(Token)`
<FromGitter> <tenebrousedge> did you declare a new `Array` in there?
<FromGitter> <absolutejam_gitlab> My issue is, I'm never making the type more broad, I'm either returning the same type or restricting it further
<FromGitter> <ArtLinkov> Here's an example of my code for mysql: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d483c507a151629e12a62db]
<FromGitter> <naqvis> @absolutejam_gitlab any example along with problem will help here
<FromGitter> <Blacksmoke16> i could go either way, one hand it makes sense since the restriction is just allowing any array with a type of any of those unioned types, while the return type is actually enforcing what it should be
<FromGitter> <ArtLinkov> I have no clue what key i t refers too
<FromGitter> <Blacksmoke16> doesnt actually mean the input type is *GOING* to always be of type `Array(Token)`
laaron has joined #crystal-lang
<FromGitter> <Blacksmoke16> its an issue with mysql8 @ArtLinkov
<FromGitter> <Blacksmoke16> i think
<FromGitter> <ArtLinkov> @Blacksmoke16 what do you mean?
<FromGitter> <Blacksmoke16> are you using mysql8? or?
<FromGitter> <ArtLinkov> The JSON support?
<FromGitter> <ArtLinkov> Yes I do
* FromGitter * tenebrousedge grumbles about 3NF
<FromGitter> <Blacksmoke16> is my vote as to what it is
<FromGitter> <Blacksmoke16> due to the `245`
<FromGitter> <Blacksmoke16> oh wait, its `254` rip
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal-mysql/issues/64 this one
<FromGitter> <ArtLinkov> Well I did have the 254 problem earlier XD ⏎ But I managed to fix it haha
<FromGitter> <Blacksmoke16> mysql shard doesnt support MySQL JSON type
<FromGitter> <ArtLinkov> Oh man... This sucks
<FromGitter> <Blacksmoke16> coughpgisbettercough
<FromGitter> <tenebrousedge> pg does have better JSON support
<FromGitter> <ArtLinkov> I really need it
<FromGitter> <Blacksmoke16> just use postgres tbh
<FromGitter> <Blacksmoke16> plus an ORM might be helpful
<rkeene> COMDB2
<FromGitter> <ArtLinkov> Hmm... I didn't think about PG... How is it performance-wise vs. mysql?
<FromGitter> <Blacksmoke16> https://hackr.io/blog/postgresql-vs-mysql
<rkeene> comdb2-vs-postgresql
<FromGitter> <tenebrousedge> mysql tends to be on par for the common webapp uses, but is otherwise completely outclassed
<rkeene> tenebrousedge, MySQL does a few things better than PostgreSQL
<FromGitter> <tenebrousedge> like what?
<rkeene> I tried to migrate a relatively simple tool from SQLite3 to PostgreSQL, but Postgres's indexing wasn't fancy enough, I had to move to MySQL
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
<FromGitter> <tenebrousedge> what were you trying to do?
<rkeene> tenebrousedge, There are a couple of things -- one is replication is handled differently in MySQL (Postgres replicates by telling the slaves how to update their files, by file position); Another is indexing, MySQL (and SQLite) both support better indexing options
<rkeene> Nothing too complicated, I was surprised Postgres didn't support it
<FromGitter> <Blacksmoke16> maybe it does now?
<rkeene> No, it was like a year ago
<rkeene> It didn't support querying the index to count the rows or something like that
laaron has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://wiki.postgresql.org/wiki/Index-only_scans something like that?
<FromGitter> <Blacksmoke16> ah gotcha
<FromGitter> <naqvis> @ArtLinkov https://github.com/crystal-lang/crystal-mysql/pull/65 This PR states to add basic JSON support to mysql driver
<rkeene> Uber also moved their stuff from Postgres to MySQL due to replication issues and they wrote a good post about why replication is bad with Postgres
<rkeene> COMDB2, however, avoids all those problems ;-)
<rkeene> (It also has good Tcl bindings !)
duane has quit [Quit: Lost terminal]
duane has joined #crystal-lang
ht_ has joined #crystal-lang
ua has quit [Ping timeout: 272 seconds]
<FromGitter> <absolutejam_gitlab> wait, does `ARGV` stringify everything?
ua has joined #crystal-lang
<FromGitter> <ArtLinkov> got it thanks @Blacksmoke16 @tenebrousedge, I'll check it out :)
<FromGitter> <tenebrousedge> @absolutejam_gitlab I mean, you will only get strings, but it's not Crystal's fault
<FromGitter> <absolutejam_gitlab> Fuck. Then I don't need this stupid Union
<FromGitter> <Blacksmoke16> :p
<FromGitter> <absolutejam_gitlab> and I can just parse to `Int`/`Bool` last
<FromGitter> <tenebrousedge> :plus1:
<FromGitter> <ArtLinkov> @Blacksmoke16 whats the driver schema for pg?
<FromGitter> <Blacksmoke16> hm?
<FromGitter> <ArtLinkov> ```mysql://etc..."``` ⏎ What do I set instead of 'mysql'?
<FromGitter> <Blacksmoke16> postgres
<FromGitter> <ArtLinkov> Ah... I wrote 'postgre' lol ⏎ Thank!
<FromGitter> <Blacksmoke16> np
duane has quit [Ping timeout: 245 seconds]
flaviodesousa has quit [Quit: KVIrc 4.9.3 Aria http://www.kvirc.net/]
duane has joined #crystal-lang
<FromGitter> <bew> @watzon what parts of the impl of `cute` you don't like?
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
lucasb has quit [Quit: Connection closed for inactivity]
Nekka has quit [Quit: zzz]
Nekka has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
Yxhuvud has joined #crystal-lang
<FromGitter> <watzon> I just think I've been spoiled by NodeJS haha. The EventManager API is just intuitive.
<FromGitter> <watzon> Also cute hasn't been updated in 2+ years, so it would almost definitely need some patching
laaron has quit [Remote host closed the connection]
<FromGitter> <kniknoo> Agreed, 2 years without an update usually makes me scroll by a library. Even just a Readme update every release that says "works with #{cr_version}" would be nice.
laaron has joined #crystal-lang
ht_ has quit [Quit: ht_]
<FromGitter> <AregevDev> Hello, I am developing `lib` bindings for a C library. How can I check if a C define is defined?
<FromGitter> <watzon> @AregevDev what do you mean "check if a C define is defined"?
<FromGitter> <tenebrousedge> I would assume that whatever `#define` test was happening would have to be replicated in Crystal, but I have very little knowledge of these things
<FromGitter> <watzon> Oh yeah, you can't use C macros in Crystal
<FromGitter> <watzon> You will have to re-define them
<FromGitter> <AregevDev> I am looking for the equivalent of #ifndef
<FromGitter> <AregevDev> Oh
<FromGitter> <greenbigfrog> hm. am I remembering something wrong or not. ⏎ Can I have an enum as type in a DB.mapping?
<FromGitter> <AregevDev> Any alternative in that case?
<FromGitter> <Blacksmoke16> @greenbigfrog would prob have to specify a converter
<FromGitter> <watzon> @AregevDev you might have to write a wrapper in C and then bind that
<FromGitter> <greenbigfrog> how do I do such again?
<FromGitter> <greenbigfrog> (or where can I find the docs)
<FromGitter> <greenbigfrog> I find the DB docs rly weird to navigate/find what I'm looking for
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d48991b45da450fecb07e1d]
<FromGitter> <Blacksmoke16> something like that
<FromGitter> <Blacksmoke16> er
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d489935d7fc954750066d08]
<FromGitter> <Blacksmoke16> then in your mapping `converter: EnumConverter`
<FromGitter> <Blacksmoke16> ofc could use generics to make it more reuseable
DTZUZU has quit [Quit: WeeChat 2.2]
<FromGitter> <AregevDev> ```typedef void (*TraceLogCallback)(int logType, const char *text, va_list args);``` ⏎ ⏎ How would one write this inside of a Crystal `lib`? [https://gitter.im/crystal-lang/crystal?at=5d489dfb7c877461651abd44]
<wmoxam> How much RAM does it take to build the Crystal compiler these days? I'm trying to build on OpenBSD and am getting "LLVM_ERROR: out of memory"
<wmoxam> It's on a vm with 12GB RAM allocated, and am using LLVM 8
<mps_> wmoxam: I build it on Alpine linux with 6GB RAM and 8GB swap
<mps_> didn't worked with 4GB swap, had to extend it
<mps_> also, llvm8
<wmoxam> mps_: ok, thanks
<wmoxam> I've only got 1.5GB swap
<mps_> I created swapfile, not swap partition
lucasb has joined #crystal-lang
<mps_> maybe I could go with less swap if I stopped firefox and some lxc containers, but just increased swapfile, it was easier and didn't wanted to stop active sessions
moei has quit [Quit: Leaving...]
<mps_> still have no luck at aarc64
<FromGitter> <j8r> Have you zswap mps_?
<FromGitter> <j8r> Not sure it's a RAM issue at the end.
<mps_> j8r: no, I have big lxc container with 128GB RAM
<FromGitter> <j8r> Woa :o
<mps_> no, it is not RAM size related
<mps_> I thought to check it tomorrow again, today I had a lot of work on some unrelated things
<mps_> as a distro dev I have some privileges, 64 CPU's and 128GB RAM, although I mostly use 8 to 16 of them and not more than 20GB RAM
sorcus has quit [Ping timeout: 276 seconds]
<mps_> j8r: good night, see you tomorrow
<FromGitter> <bew> @AregevDev something like `alias TraceLogCallback = Proc(LibC::Int, LibC::Char*, LibC::VaList)`
<FromGitter> <bew> oops forgot the return value
<FromGitter> <bew> `alias TraceLogCallback = Proc(LibC::Int, LibC::Char*, LibC::VaList, Void*)`
<FromGitter> <absolutejam_gitlab> Somebody write me an Oauth2 lib for google cloud
<FromGitter> <absolutejam_gitlab> cba doing flow
<FromGitter> <bew> @absolutejam_gitlab could you use a generic OAuth2 lib?
<FromGitter> <absolutejam_gitlab> I want to do a service account though, not the user flow
<FromGitter> <absolutejam_gitlab> and for everything in the docs it's 'USE THE CLIENT LIBRARIES'
<FromGitter> <absolutejam_gitlab> Well there aint one for Crystal
<FromGitter> <bew> hehe of course 😬
<FromGitter> <bew> that's not small task either
<FromGitter> <watzon> Definitely not. I've looked into it myself
<FromGitter> <absolutejam_gitlab> They generate all their client libs
<FromGitter> <absolutejam_gitlab> but still, PITA. Lot of stuff to generate
<FromGitter> <absolutejam_gitlab> or sed the ruby stuff πŸ˜‰
<FromGitter> <bew> huuuge sed then x)
<FromGitter> <absolutejam_gitlab> there is `def get_access_token_using_client_credentials(scope = nil) : AccessToken`
<FromGitter> <bew> time2bed.call() # bye!
<FromGitter> <absolutejam_gitlab> gn
<FromGitter> <tenebrousedge> @absolutejam_gitlab I think I've written an OAuth2 lib before, for PHP. It wasn't a horrible ordeal
<FromGitter> <absolutejam_gitlab> might look over next few days...
<FromGitter> <absolutejam_gitlab> I really like Crystal, but since it's so fresh-faced,there's a lot of yak shaving