<jhass>
BlaXpirit: just had a thought, the bot should probably have an option to ignore a Gitter and perhaps IRC user in the mid term, not sure how active ops are over there...
snsei has quit [Remote host closed the connection]
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
matp has joined #crystal-lang
Oliphaunte has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
A124 has quit [Quit: '']
A124 has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 240 seconds]
Oliphaunte has quit [Remote host closed the connection]
snsei has joined #crystal-lang
dgaff has joined #crystal-lang
<dgaff>
Hey all - whats the crystal equivalent of 1.methods?
<dgaff>
(the 1.methods being the list of available methods for an object in ruby)
<jhass>
p {{Int32.methods.map(&.name.symbolize)}}
<jhass>
pulling up the API docs is easier ;(
<jhass>
er, ;)
<dgaff>
gotcha - Yeah, I'm working with a mongo shard that looks pretty derelict, so I'm trying to figure out what the types were for everything. I am nearly up to the pieces for a crud API but there's still some weirdness with refreshing documents from the DB.
<dgaff>
For instance, pulling back the documents, in order to collect some Integer field from the objects, without recasting them from whatever the hell the type is, I had to do something like `arr = [] of (BSON | BSON::Code | BSON::MaxKey | BSON::MinKey | BSON::ObjectId | BSON::Symbol | BSON::Timestamp | Bool | Float64 | Int32 | Int64 | Regex | String | Time | Nil)`
<dgaff>
Which, obviously, isn't ideal.
<dgaff>
This language looks stupid cool though. 10 years on Ruby has made me loathe the speed issues, and seeing Mike Perham put up a link about Sidekiq being ported is the thing that pushes me into crystal I think.
<jhass>
I would expect an alias for that type to exist somewhere
sandelius has left #crystal-lang ["Textual IRC Client: www.textualapp.com"]
soveran has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
daneb has joined #crystal-lang
daneb has quit [Remote host closed the connection]
daneb has joined #crystal-lang
bjz has joined #crystal-lang
ome has joined #crystal-lang
daneb has quit [Ping timeout: 272 seconds]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
matp has quit [Remote host closed the connection]
sebasr has quit [Ping timeout: 250 seconds]
daneb has joined #crystal-lang
greenarrow has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
matp has joined #crystal-lang
Guest__ has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 272 seconds]
sebasr has joined #crystal-lang
daneb has quit [Remote host closed the connection]
daneb has joined #crystal-lang
daneb has quit [Remote host closed the connection]
matp has quit [Remote host closed the connection]
daneb has joined #crystal-lang
Guest80941 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
matp has joined #crystal-lang
trapped has joined #crystal-lang
daneb has quit [Remote host closed the connection]
daneb has joined #crystal-lang
daneb has quit [Remote host closed the connection]
daneb has joined #crystal-lang
Guest80941 has quit [Quit: Leaving]
pawnbox has joined #crystal-lang
coderobe has joined #crystal-lang
<coderobe>
Hey, i've noticed that something like `s = gets.split(",")` won't compile in crystal, instead it throws the error "undefined method 'split' for Nil (compile-time type is String?)". Is that intentional, not fully implemented or a bug?
<coderobe>
If i try to set the type of `s` to string by doing `s : String` i get `declaring the type of a local variable is not yet supported`, too so i have no idea how to tell the compiler that this is going to be a string
<BlaXpirit>
coderobe, it is intentional, because it is not guaranteed that `s` will always be a string
<coderobe>
Oh, that sample is very helpful. I'll look into that
<coderobe>
again, thanks for the fast response
<jhass>
coderobe: another approach you can do s = gets.try &.split(","), that way you either get the array or nil in s if Ctrl+D was pressed
Guest80941 has quit [Quit: Leaving]
Dreamer3_ has quit [Quit: Leaving...]
kochev has joined #crystal-lang
<coderobe>
Another question related to gets: Is it possible to disable echoing of the input string, or to replace the echo method with something else?
<coderobe>
Say i want to read a password or something else that might be confidental
icezimm has joined #crystal-lang
<jhass>
I don't think we have anything in stdlib yet
<jhass>
I just bound getpass(3) for the one case I needed it :/
<jhass>
(which is deprecated even...)
<BlaXpirit>
yup, i cant find anything either
<jhass>
in theory the termios stuff is already there, so it shouldn't be tooo hard
<jhass>
but idk how it interacts with libevent and stuff
<FromGitter>
<k-solutions> Hello All, I just wonder if crystal run --debug is any useful for debugging currently ?
<BlaXpirit>
@k-solutions I think --debug is the default, you just disable it with --release
<jhass>
@k-solutions: with LLVM 3.5 it does generate source code annotations readable by gdb/lldb/valgrind for a lot of stuff already, so somewhat
<jhass>
BlaXpirit: nope
<BlaXpirit>
oh sorry then
<jhass>
we even have a bug report open where something crashes with --debug but not without -.-
<BlaXpirit>
jhass, do you wanna enable colors for this channel so the bot can show the names more nicely?
<jhass>
we can try
<jhass>
what a colorful world
<jhass>
sorry
<BlaXpirit>
looks so nice in gitter
<FromGitter>
<k-solutions> Thanks, as I'm coming from ruby valgrand seems like nice choice, but could request some more info or howto link ?
<jhass>
haha
<jhass>
@k-solutions it's quite limited atm tbh, puts debugging gets your further for most stuff. Anything specific you're stuck on?
<FromGitter>
<k-solutions> well I try to explore 0mq and I get stuck with it in some of the more complex code examples, and I guess I'm spoiled by pry but need a tool to trace my code execution
Arahael has joined #crystal-lang
Bish has quit [Read error: Connection reset by peer]
edjsu has quit [Ping timeout: 260 seconds]
icezimm has quit [Quit: Leaving.]
ome has quit [Quit: Connection closed for inactivity]
<get_durnk>
can we add a link to the gitter to either the channel topic of the github readme?
<get_durnk>
or*
<BlaXpirit>
I don't know whether I'd be happy about that, but probably should be done
<jhass>
get_durnk: I'd still like to keep clear that this is considered our blessed "chat" channel
<jhass>
I think the people fanatic about using Gitter will find it
<get_durnk>
right, but there is no mention anywhere of the gitter channel from anything crystal-official
<get_durnk>
so is the gitter an official crystal 'thing'?
<jhass>
I wouldn't say so
<BlaXpirit>
well a random joe can't get ownership of crystal-lang/crystal room but
kochev has quit [Ping timeout: 250 seconds]
paulcsmith_ has joined #crystal-lang
icezimm has joined #crystal-lang
snsei has joined #crystal-lang
<shadowshell>
Congrats on 0.18.0 folks! The `partial` method on `Proc` is rad af!
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
bcardiff has joined #crystal-lang
kochev has joined #crystal-lang
dgaff has quit [Ping timeout: 258 seconds]
Renich has joined #crystal-lang
<get_durnk>
crystal is starting to look like a real language lately
daneb has quit [Remote host closed the connection]
<FromGitter>
<asterite> So IRC can see this from gitter...?
<asterite>
seems so :-)
<asterite>
We could probably make that gitter place then official
daneb has joined #crystal-lang
daneb has quit [Remote host closed the connection]
<get_durnk>
yup
<get_durnk>
which would be highly confusing to a new user and should be mentioned somewhere, but whatever
<FromGitter>
<tilpner> ``` ⏎ puts "Test code. Will be edited." ⏎ ```
fryguy9 has quit [Quit: Leaving.]
<BlaXpirit>
yeah, if anyone finds an API for message edits on gitter, i'm all ears
<tilpner>
You may consider also indicating edits. Yes, they add noise, but if someone asks for help on Gitter, then edits their code, you could end up talking about different snippets.
<BlaXpirit>
I don't see any way to receive the edits
Philpax has quit [Ping timeout: 252 seconds]
<tilpner>
The Gitter bridge does it, I don't know if they expose that.
<BlaXpirit>
then it could be an option to connect to gitter bridge instead
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<shadowshell>
Looks like all the packages for crystal on Archlinux are out of date or broken. The aur crystal-git won't build because the std/socket_spec.cr has 4 failures. I grabbed the official crystal package and attempted to update it to the latest official release. Guess what, same 4 tests fail. Is this a known issue, those failing test on a released version? Or
<shadowshell>
something specific to arch?
<shadowshell>
I'm happy to continue to dig into this and update those packages, but don't want to chase my tail :)
<coderobe>
shadowshell: what about community/crystal ?
<shadowshell>
out of date coderobe: `community/crystal 0.17.3-1`
<shadowshell>
that is the one i attempted to update to 0.18.0-1
<shadowshell>
but that release fails on 4 specs in arch
<BlaXpirit>
shadowshell, i think crystal-git should work just find
<BlaXpirit>
fine
<shadowshell>
hmm, maybe my env is making it break somehow
<shadowshell>
the spec i mean
<jhass>
shadowshell: yeah the specs pass just fine for me for crystal-git
pawnbox has quit [Ping timeout: 250 seconds]
<coderobe>
shadowshell: I'll attempt to build aur/crystal-git, will tell you if it breaks for me too
<jhass>
I build the package before I update it :)
<asterite>
jhass: how do I know when travis will run with 0.18.0?
<shadowshell>
here is what i get
<jhass>
asterite: does already
<shadowshell>
i have nothing running on those ports
<shadowshell>
i maybe disabled ipv6 because my isp is an ass wrgt it at the moment
<BlaXpirit>
. . .
<shadowshell>
but...not sure that should cause the package to fail to be installed....but that is a tough one
<asterite>
jhass: excellent, thanks!
<shadowshell>
how are you going to know what idiot out there disables ipv6 ;)
<jhass>
shadowshell: it's probably because your /etc/hosts still has an entry for ::1
<shadowshell>
ah, looking jhass
<BlaXpirit>
jhass, shadowshell, that would fix the first failure but not the next ones
<jhass>
well yeah
<jhass>
ipv6 is the future, disable ipv4 instead!
<BlaXpirit>
shadowshell, breaking ipv6 is not the way to go, I don't see why you would do that
* jhass
vanishes
<shadowshell>
you are correct on that account: `::1 localhost.localdomain localhost`
<shadowshell>
heh
<shadowshell>
i know you are right
<shadowshell>
now tell my isp
<BlaXpirit>
my isp doesn't pass on ipv6 traffic but that doesn't mean i should break it locally
<BlaXpirit>
shadowshell, you can edit pkgbuild and remove spec from it
<coderobe>
afaik linux doesn't care if your isp doesn't speak ipv6
<jhass>
I just bypass my ISP, tunnelbroker.net endpoint on my router, done
<jhass>
home network thinks it has full DS
<shadowshell>
coderobe: it does when they advertise ipv6 dns servers that don't work!
<shadowshell>
and i kept forgetting
<shadowshell>
so i just disabled ipv6 for now...brute...wrong..works
<jhass>
eh sounds again like something you should be able to fix in the router
<shadowshell>
it is, totally
<shadowshell>
i'm just kept dealing with and got mean to myself
<shadowshell>
not your problem :)
<jhass>
:)
<shadowshell>
thanks for the pointers
<shadowshell>
and yes, i totally disabled specs in PKGBUILD to get past it
<shadowshell>
but thought it might be a real thing
<shadowshell>
thanks again!
<jhass>
shadowshell: makepkg --nocheck ;)
tilpner has quit [Quit: :wq]
tilpner has joined #crystal-lang
<coderobe>
so i tried (and failed) to write a getch / gets method with input masking support https://gist.github.com/coderobe/5b443560287f540e06b6216f141c79fd - for some reason the del_chars method doesn't work when the input is masked & only triggers after the second keypress
<jhass>
ah I don't think that's the correct approach, setting noecho through termios would be
<jhass>
your issue is probably related do to STDOUT buffering or libevent delaying it or so
<jhass>
idk, did we put STDOUT in synchronous mode?
matp has quit [Ping timeout: 276 seconds]
paulcsmith_ has joined #crystal-lang
<coderobe>
I believe my issue really is related to stdout buffering, because calling `print ""` immediately after del_chars refreshes stdout properly
<BlaXpirit>
coderobe, well maybe it is. flush it until it works
<coderobe>
Huh, thats weird. When calling pipe.print "" inside of del_chars i get a compiler error, doing it right after calling del_chars works though
<BlaXpirit>
coderobe, something about the return value?
<BlaXpirit>
what is del_chars anyway
<coderobe>
A method from the gist i linked a few messages ago
<coderobe>
Yeah, the compiler error was the return value.
<coderobe>
I think i found a bug though
<coderobe>
STDOUT.print "asdf" does not refresh the terminal until a standalone `print` (or an alternative) is called
<BlaXpirit>
coderobe, it's called buffering
<coderobe>
Buffering without a flush method is kinda counterproductive
<jhass>
asterite: did you already drop the Crystal::VERSION == "0.18.0" stuff locally?
<FromGitter>
<jwoertink> This is sweet!
soveran has quit [Remote host closed the connection]
<BlaXpirit>
message count in gitter has probably doubled by now
<jhass>
more like 10 times :P
<FromGitter>
<jwoertink> I have a question about an error I was getting yesterday. I was having trouble understanding what it was telling me
<FromGitter>
<jwoertink> `must be String, not String?`
<jhass>
String? is the same as String|Nil
<FromGitter>
<jwoertink> So the second one is more like a union?
<jhass>
so you probably didn't initialize an instance var somewhere or tried to assign nil to something you declared to be String otherwise
<jhass>
not like, it is one
<FromGitter>
<jwoertink> lol. :thumbsup: gotcha. Ok. I had a method that I was writing a spec for which would return string, but since I wasn't done, there was an edge case where it returned nil
<txdv>
hello?
<BlaXpirit>
txdv, hello
Guest__ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<FromGitter>
<jwoertink> I read somewhere that you can use lldb and then compile with a `--debug` flag to debug your apps. Is there anything similar when running `crystal spec`?
<coderobe>
jwoertink: "[--debug] is quite limited atm, puts debugging gets you further for most stuff"
<jhass>
heh I get quoted! am I famous now?
pawnbox has joined #crystal-lang
<coderobe>
;)
<FromGitter>
<jwoertink> Yeah, that's what I'm doing at the moment. My only issue was the method I was debugging kept throwing that `must be String, not String?` error instead of running my `puts`. Overall not bad, I was just curious if there was a better "undocumented" way. Thanks!
<jhass>
@jwoertink: well that's a compile time error, so you don't even get a binary you could debug with lldb not mater whether you add --debug or not ;)
<FromGitter>
<jwoertink> I do like that it really makes me focus on my method design. :smile:
ruslux has joined #crystal-lang
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<ruslux>
Thanks for .18!
dgaff has joined #crystal-lang
get_durnk has quit [Ping timeout: 250 seconds]
<coderobe>
Are there any known shards that bind (n)curses?
<jhass>
?debugging=If you're using LLVM 3.5 there's experimental debugging support available via the --debug flag to crystal compile. It makes the source location of many expressions available to tools like lldb, gdb or valgrind. You can also call debugger in your code to add a debug trap. However most of the time it's easier to use the pp macro and similar.
<DeBot>
jhass: Set debugging.
Oliphaunte has quit [Remote host closed the connection]
<jhass>
btw sharing code with screenshots is... mmmh :P
<coderobe>
yeah i know i know
<coderobe>
it's only 4 lines tho
Oliphaunte has joined #crystal-lang
<coderobe>
removing the second assignment from the code "fixes" the compiler error, instead it'll tell you " declaring the type of a local variable is not yet supported"
<coderobe>
def bug x : String = "asd" end
<coderobe>
vs def bug x : String, y = ["asd",1] end
<jhass>
yes yes, definitely a bug, please open an issue ;)
<coderobe>
will do
<jhass>
def bug
<jhass>
x : Int32, y = 1
<jhass>
end
<jhass>
bug
<jhass>
seems enough btw
<jhass>
takes complex types such as array and string out of the mix
Oliphaunte has quit [Ping timeout: 250 seconds]
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: https://git.io/voRUe
<crystal-gh>
crystal/master 7977b77 Ary Borenszweig: OAuth2: define `new(JSON::PullParser)` on access token subclasses so they can be deserialized too
<crystal-gh>
crystal/master 71bca5d Ary Borenszweig: Removed Crystal version checks
<FromGitter>
<jmoriau> hi, I just updated to 0.18.0 (ubuntu 14.04) and running `crystal spec` now gives me ⏎ /usr/bin/ld: cannot find -lxml2 ⏎ collect2: error: ld returned 1 exit status ⏎ Error: execution of command failed with code: 1: `cc -o "/home/user/.cache/crystal/crystal-run-spec.tmp" "${@}" -rdynamic -L/usr/lib -L/usr/local/lib -lz `pkg-config --libs libssl || echo -n -lssl -lcrypto` `pkg-config --libs libcrypto || echo -n -lcrypto`
<FromGitter>
<zcassini> I'm getting an error trying to get crystal_lib to work. ⏎ ``` ⏎ crystal src/main.cr -- examples/lib_curses.cr ⏎ Error in ./src/main.cr:6: instantiating 'Crystal::ASTNode+#transform(CrystalLib::LibTransformer)' ⏎ ``` ⏎ ive tried it with crytsal version 18, 17.4, 16 and get the same error. Anyone know what I'm doing wrong here? [https://gitter.im/crystal-lang/crystal?at=5761a2f036c83a880206021f]
daneb has joined #crystal-lang
daneb has quit [Client Quit]
daneb has joined #crystal-lang
matp has joined #crystal-lang
<BlaXpirit>
@zcassini that's not the whole error, is it?
LastWhisper____ has quit [Read error: Connection reset by peer]
daneb has left #crystal-lang [#crystal-lang]
<BlaXpirit>
@zcassini, no, that's not the problem
<BlaXpirit>
the actual problem is what's actually written, on the last line
<coderobe>
BlaXpirit: would the compiler still say `undefined method 'raise' for...` if that was the case?
<coderobe>
seems off imo
<BlaXpirit>
coderobe, yeah it is off but something unusual is happening
<coderobe>
i see
<BlaXpirit>
coderobe, normally that would work, i think arg.raise is just a method that does raise with additional info
Nik736 has joined #crystal-lang
<BlaXpirit>
if I remember correctly, crystal_lib requires like an empty lib with some annotations, right? @zcassini well, something is probably wrong with the base file you're feeding it
<FromGitter>
<zcassini> @blaxpirit i tried a few of the example fiels and had the same problem. i didnt try them all though.
<BlaXpirit>
I don't know... maybe it needs to be started differently
ruslux has quit [Ping timeout: 264 seconds]
<FromGitter>
<zcassini> i'll open an issue on github for it. thanks
<BlaXpirit>
@zcassini, hm no I really think we need to debug it, we need to find out how you're running it
<BlaXpirit>
@zcassini maybe go to gist.github.com and paste all the puzzle pieces, like the header you're feeding it, the base crystal lib file, the command you're running
<BlaXpirit>
@zcassini, I'm sorry, you're totally right. I just got an opportunity to try it out and I got the same error
<Yxhuvud>
PHP almost has the same behavior regards to ?:, except it has a difference precendence so if you nest it you get a totally different behavior.
<FromGitter>
<zcassini> @BlaXpirit well at least i know i'm not doing it wrong.
<jhass>
Yxhuvud: you can do $foo = if(true) { 1 } else { 2 }; in PHP?
<Yxhuvud>
dunno, but it has ?:, but with different precendence of the : compared to every other language that also have ?:
<jhass>
well the entire point is that it's equivalent by that working
<BlaXpirit>
no, does not work like that
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
paulcsmith_ has joined #crystal-lang
tomchapin has joined #crystal-lang
<FromGitter>
<k-solutions> Anyone tried out to compile crystal for ARM ?
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<FromGitter>
<zcassini> After the update I still have problems with crystal-lib. ⏎ ```` ⏎ crystal src/main.cr -- examples/lib_curses.cr ⏎ /usr/bin/ld: /opt/crystal/embedded/lib/../lib/libgc.a(os_dep.o): undefined reference to symbol '_end' ⏎ //usr/lib/x86_64-linux-gnu/libffi.so.6: error adding symbols: DSO missing from command line ⏎ collect2: error: ld returned 1 exit status ⏎ ``` ⏎ I have libffi6, libffi-dev, libffi6:i386 and libffi6-dbg
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
dgaff has quit [Ping timeout: 252 seconds]
soveran has quit [Remote host closed the connection]
Oliphaunte has quit [Remote host closed the connection]
<crystal-gh>
[crystal] asterite pushed 7 new commits to master: https://git.io/voRdU
<crystal-gh>
crystal/master 40a0fca Ary Borenszweig: Fixed #2840: transform methods on abstract class and modules without subtypes to untyped expressions
<crystal-gh>
crystal/master 1c5e6f1 Ary Borenszweig: Fixed #2844: Bug when rescueing exception using method argument
<crystal-gh>
crystal/master 7773609 Ary Borenszweig: MemoryIO: raise if closed on read and clear
paulcsmith_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]