ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.1 | 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
<FromGitter> <bew> "When you index a string with a char instead of a string" ...
<FromGitter> <bew> That doesn't even make sense
Creatornator has joined #crystal-lang
Creatornator has quit [Client Quit]
<RX14> nope
<RX14> also starts_with? Char being slower doesn't make sense
<RX14> i mean it does
<RX14> but i mean it should be optimized
<RX14> thanks for noticing it
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 240 seconds]
astronavt has joined #crystal-lang
DTZUZO has quit [Read error: No route to host]
DTZUZO has joined #crystal-lang
illyohs has quit [Ping timeout: 268 seconds]
Creatornator has joined #crystal-lang
astronavt has quit [Remote host closed the connection]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
Creatornator has quit [Client Quit]
qard has joined #crystal-lang
alex`` has joined #crystal-lang
alex`` has quit [Client Quit]
<FromGitter> <bararchy> RX14 if it helps in any way, I'm using HEAD for ... a month now ? seems stable enough
qard has quit [Ping timeout: 276 seconds]
qard has joined #crystal-lang
<FromGitter> <elorest> Any idea why I would be getting this error when defining a method with the first arg defaulted but the second not? "argument must have a default value"
alex`` has joined #crystal-lang
<FromGitter> <bararchy> yeha
<FromGitter> <bararchy> the defaults has to be at the end of method
<FromGitter> <bararchy> as in ⏎ def bar(c, a="", b="")
<FromGitter> <bararchy> the other way around wont work
<FromGitter> <bararchy> not sure why, just know it behaves like that
flaviodesousa has joined #crystal-lang
<FromGitter> <bararchy> btw, does LLVM support some kind of code obfuscation?
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aroaminggeek has quit [Quit: Textual IRC Client: www.textualapp.com]
claudiuinberlin has joined #crystal-lang
Papierkorb_ has joined #crystal-lang
<FromGitter> <codenoid> hi, is crystal have method to check is this string online contain number
<FromGitter> <elorest> @bararchy LOL. No kidding. I should have gone to be hours ago lol. :)
<Papierkorb_> codenoid, Can you try to rephrase that? What are you looking for?
<FromGitter> <bararchy> @codenoid why not use Regex ?
oprypin has quit [Ping timeout: 240 seconds]
vegai has quit [Ping timeout: 268 seconds]
oprypin has joined #crystal-lang
vegai has joined #crystal-lang
<FromGitter> <bararchy> Why does calling C code block the whole libevent thread ?
<FromGitter> <bararchy> would that also happen when we go multi-threaded ?
<FromGitter> <codenoid> i'm just asking ;D hehe, i use ⏎ ⏎ ```def check_string?(string) ⏎ string.scan(/\D/).empty? ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5a1fcd01ffa3e37919da3c16]
<FromGitter> <bararchy> you can also go char-char and see that `Char#ord` isn't higher then or lower then the ascii represntation of the numbers
<FromGitter> <bararchy> XD
<FromGitter> <codenoid> or "fkwof242424".to_i with begin rescue xD
<FromGitter> <bararchy> raise is very costly XD ⏎ ⏎ But I don't know if my suggestion will be faster or slower in execution then Regex
rohitpaulk has joined #crystal-lang
kp666[m] has quit [Ping timeout: 240 seconds]
dtcristo has quit [Ping timeout: 240 seconds]
braidn[m] has quit [Ping timeout: 240 seconds]
olbat[m] has quit [Ping timeout: 240 seconds]
minus has quit [Ping timeout: 240 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
kosmonaut has quit [Ping timeout: 260 seconds]
kosmonaut has joined #crystal-lang
minus has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
kp666[m] has joined #crystal-lang
braidn[m] has joined #crystal-lang
olbat[m] has joined #crystal-lang
dtcristo has joined #crystal-lang
Yxhvd has joined #crystal-lang
Majost has quit [*.net *.split]
Yxhuvud has quit [*.net *.split]
FromGitter has quit [*.net *.split]
Majost has joined #crystal-lang
FromGitter has joined #crystal-lang
<FromGitter> <francescoagati> hello
<FromGitter> <francescoagati> i know that this question have been posted in other moment. but there is a branch of crystal with the multi core implementation?
<FromGitter> <sdogruyol> @francescoagati yeah
<FromGitter> <Rinkana> How can i reference another class as a property? `getter source : Class` gives me `can't use Object as the type of an instance variable yet, use a more specific type`
greenbigfrog has quit [Ping timeout: 255 seconds]
weston_[m] has quit [Ping timeout: 255 seconds]
sz0 has joined #crystal-lang
<Papierkorb_> Rinkana, you can't reference "any class", but you can reference a specific class like `property delegator : MyFooBase.class`. Classes inheriting from that class are also accepted then
weston_[m] has joined #crystal-lang
thelonelyghost has quit [Ping timeout: 252 seconds]
Renich has quit [Ping timeout: 246 seconds]
watzon has quit [Ping timeout: 246 seconds]
byteflame has quit [Ping timeout: 240 seconds]
greenbigfrog has joined #crystal-lang
<FromGitter> <lhz> Ironically you can't reference `Reference` either.
dtcristo has quit [Ping timeout: 255 seconds]
cptaffe has quit [Ping timeout: 255 seconds]
weston_[m] has quit [Ping timeout: 240 seconds]
kp666[m] has quit [Ping timeout: 264 seconds]
tybee[m] has quit [Ping timeout: 264 seconds]
TheGillies has quit [Ping timeout: 264 seconds]
olbat[m] has quit [Ping timeout: 255 seconds]
sija[m] has quit [Ping timeout: 252 seconds]
braidn[m] has quit [Ping timeout: 276 seconds]
alex`` has quit [Read error: No route to host]
olbat[m] has joined #crystal-lang
early has quit [Quit: Leaving]
alex`` has joined #crystal-lang
early has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
go|dfish has quit [Ping timeout: 255 seconds]
go|dfish has joined #crystal-lang
byteflame has joined #crystal-lang
Renich has joined #crystal-lang
kp666[m] has joined #crystal-lang
braidn[m] has joined #crystal-lang
cptaffe has joined #crystal-lang
tybee[m] has joined #crystal-lang
dtcristo has joined #crystal-lang
TheGillies has joined #crystal-lang
watzon has joined #crystal-lang
thelonelyghost has joined #crystal-lang
sija[m] has joined #crystal-lang
weston_[m] has joined #crystal-lang
Creatornator has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
<Groogy> when you been tracking down a bug for days why your v-table is trashed and you realize the only difference between when it worked and didn't is a new Clang version...
<Groogy> Do Clang have like a list of known issues?
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
csk157 has joined #crystal-lang
Papierkorb_ has quit [Quit: Konversation terminated!]
<faustinoaq> Hi, is possible to debug ECR templates?
<FromGitter> <bew> what kind of debug do you need?
<FromGitter> <lhz> Running `crystal spec --no-color` I still get coloured output, and it looks awful when running inside Emacs. Any ideas?
<faustinoaq> @bew Something like stepping ecr files using gdb?
<FromGitter> <bew> @lhz you probably want `crystal spec -- --no-color`
<FromGitter> <lhz> @bew ah, of course. thanks!
<FromGitter> <bew> in your example the `--no-color` go to the build, not to the spec execution
<FromGitter> <bew> you can have `crystal spec --no-color -- --no-color` to remove colors everywhere
<FromGitter> <johnjansen> just dont do `crystal spec --no-color -- --no-color — —no-color` as that will bubble over into the actual world … and thats no fun
<FromGitter> <bew> lool, thanks @larubujo didn't remember this one
<FromGitter> <lhz> @johnjansen 😄
<FromGitter> <lhz> will be just like in the 50s
<FromGitter> <johnjansen> they fixed the bug in the 60’s ;-)
Creatornator has joined #crystal-lang
<FromGitter> ... Osn4N2M&tbnid=_13ZUX2L9WOv5M%3A&vet=10ahUKEwj4_9Kw4-bXAhWKwFQKHRXqDtQQMwjtAShUMFQ..i&w=1300&h=1300&client=safari&bih=848&biw=1386&q=60%27s%20psychedelic&ved=0ahUKEwj4_9Kw4-bXAhWKwFQKHRXqDtQQMwjtAShUMFQ&iact=mrc&uact=8
rohitpaulk has quit [Ping timeout: 250 seconds]
<faustinoaq> XD
<FromGitter> <lhz> <= desperately clicking the link to no avail
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
csk157 has quit [Read error: Connection reset by peer]
rohitpaulk has quit [Ping timeout: 248 seconds]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
Creatornator has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
faustinoaq has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
flaviodesousa has quit [Ping timeout: 276 seconds]
rohitpaulk has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rohitpaulk has quit [Ping timeout: 240 seconds]
justicefries has joined #crystal-lang
justicefries has left #crystal-lang [#crystal-lang]
Ven has joined #crystal-lang
Ven is now known as Guest33619
<Papierkorb> RX14: Do you know how I can emit and execute JVM bytecode from within a running java program? Basically, "JIT"ing to JVM Bytecode?
<RX14> Papierkorb, like http://asm.ow2.org/ ?
<RX14> the executing part is just writing a custom classloader iirc
<RX14> I'be never *done* it
<Papierkorb> Does something like that work on Android?
<RX14> but I uded to hang around with a bunch of MC modders
<RX14> and they all -
<RX14> no i would assume not
<RX14> the android jvm isn't really... a jvm?
<Papierkorb> yeah it's dalvik or arts iirc in current androids
<RX14> what's the usecase/application?#
<Papierkorb> for a thesis project, I wondered if it'd be possible to write a dynarec C64 emulator
<Papierkorb> C64 cause that I know at least
sz0 has quit [Quit: Connection closed for inactivity]
vivus has joined #crystal-lang
<RX14> why android then?
<RX14> JVM is a good platform for it though
<RX14> thing is that the android jvm doesn't take JVM .class files
<RX14> it takes dex or whatever
<Papierkorb> Cause the professor is a mobile freak, and my uni doesn't really have professors doing low level stuff, so I make do
<RX14> :(
<RX14> port crystal to android lol
<Papierkorb> huh didn't that already exist?
<FromGitter> <bew> iirc ysbaddadded did an experiment, no idea how it gone
<FromGitter> <bew> (too much d in there)
<Papierkorb> lol
<RX14> yeah Papierkorb
<RX14> there was a start
<RX14> but its not done or merged and it would need like
<RX14> a year's worth of rebase
<RX14> so good luck lol
<Papierkorb> yeah I'm more looking to do something JITy or emulator-y
vivus has quit [Quit: Leaving]
<FromGitter> <ylluminate> what's crystal using for the gitter-irc bridge?
claudiuinberlin has joined #crystal-lang
Creatornator has joined #crystal-lang
Creatornator has quit [Client Quit]
Guest33619 is now known as Ven``
Creatornator has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <ylluminate> awesome, thanks oprypin
Ven`` has joined #crystal-lang
<FromGitter> <bew> Shouldn't this work? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a20697887680e6230b63da7]
<FromGitter> <bew> I get `undefined method 'new_method' for File`
<Papierkorb> no, File.open yields a File, not MyFile
<FromGitter> <bew> but I'm using `MyFile.open` I would expect to get a `MyFile` object
<FromGitter> <bew> in the implementation, `File.open` without a block uses `new`, and `File.open` with a block uses `File.new`, so when I call `MyFile.open` without block I get a `MyFile` object but not when using `MyFile.open` with a block, I think this is a bug
<Papierkorb> sounds like a simple PR
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
astronavt has joined #crystal-lang
<FromGitter> <ylluminate> i'm curious. i've not done much poking yet, but trying to figure out what it would take to use emscripten to compile to js/webassembly. it really looks like emscripten is the better path to follow initially. being that llvm is common between the two, is there a way to get a bytecode or some llvm output from crystal that would then be able to be fed into emscripten?
<FromGitter> <bew> @Papierkorb sounds like, yes, but might not be that simple because if I define a new constructor in `MyFile` all the other ctors are discarded, and the one used in `.open` might not exists anymore.. (not sure if it's an issue, but it looks like sth that's unexpected)
<Papierkorb> bew, I mean replacing `File.new` in File.open with just `new` or `self.new` might do the trick
<FromGitter> <bew> yes, but if I add a new ctor in `MyType`, I won't be able to use `MyType.open` anymore
<FromGitter> <bew> unless I re-define the ctor used in File.open, in MyType
<Papierkorb> I don't understand why you're subclassing File though
astronavt has quit [Ping timeout: 240 seconds]
csk157 has joined #crystal-lang
<FromGitter> <bew> my type is a File-wrapper with some more methods, and I want it to be open-able like a `File` object, without having to re-define the N kind of `.open` there is on `File`
mooe_ has joined #crystal-lang
<Papierkorb> Not necessary
<Papierkorb> Make your class a delegator
mooe_ is now known as mooe
<Papierkorb> Then implement a single `self.open(*args)` in which you do `MyFile.new(File.open(*args))`. A second one for the yielding version. done
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb> Make sure you actually want your delegator to be File specific, or if IO specific is good enough to enable wider use
<FromGitter> <bew> good point, thank you
Creatornator has joined #crystal-lang
ryan_ has joined #crystal-lang
<Papierkorb> Oh and consider inheriting your delegator from IO too
<ryan_> Hi guys, I'm trying to use the File.basename function to get the filename without the extension. I was hoping to just use the wildcard to grab all extensions and remove them. That doesn't seem possible though. Any ideas?
<ryan_> `File.basename("test.txt", ".*")`
<FromGitter> <bew> ryan_ what do you mean "all extensions", in your example there's only one extension (`".txt"`)
<FromGitter> <bew> Papierkorb: what do you mean "inheriting your delegator from IO" ?
<Papierkorb> `class MyFile < IO`
<ryan_> The user can input .txt files or .csv
<FromGitter> <paulcsmith> @ylluminate Great question. I'd also love to hear if anyone has had success generating code with emscripten from Crystal. I found this presentation (https://kripken.github.io/talks/binaryen.html#/11) and I'm looking into some articles to see what might be required
<FromGitter> <bew> @Papierkorb oh ok, in my case it's really a file (no generic enough to be an io), but now that I re-think about it I can do better and get ride of this File-like object
<ryan_> (I hardcoded that "test.txt"). The filename is inputted through the commandline, so I would like to put the file name into a variable (excluding extension). I know in Ruby I could write `fn = File.basename(ARGV[0], ".*")`
<Papierkorb> bew, yay!
<FromGitter> <paulcsmith> But it'd be great if someone with more experience could give some pointers
<FromGitter> <bew> ryan_ why not simply use `File.basename(ARGV.first)` ?
<FromGitter> <ylluminate> right, saw the same presentation @paulcsmith. it would be great to have a solid entry point vs futzing about as i feel i'm doing :D
<ryan_> Because basename returns the extension, which I don't want included
<ryan_> The second parameter allows stripping of the extension.
<RX14> @ylluminate the problem isn't emitting code it's having GC
<RX14> and webassebly's core design simply doesn't permit GC right now
<FromGitter> <bew> oh right sorry, there's `File.extname(path)` to get the extension, you could use this as 2nd arg to basename
<ryan_> Ah yeah, good idea!
<Papierkorb> ryan_: basename's suffix stripping doesn't allow for such operations, as it's not clear in all cases what to do (e.g., "foo.tar.gz" should be reduced to "foo.tar" or to "foo"?).
<RX14> sure, you can probably compile a hello world for wasm (and it really doesn't matter if you use emscripten or core llvm, but i'd recommend just using core llvm because it's easier)
<RX14> but it wouldn't be "useful"
<RX14> and dumping llvm bytecode doesn't help because the bytecode is platform-specific in numerous ways
<Papierkorb> RX14: https://github.com/linkedin/dexmaker Ding ding ding
<RX14> cool Papierkorb
<FromGitter> <ylluminate> so gc is actually important in webasm? i was under the impression that since it would be converted to js (until webasm is actually ready) this would be handled by the browser / js vm
<Papierkorb> RX14: I was already wondering how I should map a register-based CPU to a stackbased VM. No idea how an algorithm for that is called. But: the Dalvik VM is register based. Jackpot lul.
<FromGitter> <ylluminate> therefore gc is really not an issue until it shifts to actual webasm
<ryan_> I see your concern
<RX14> yes it will be handled by the browser gc
<RX14> they just havn't defined any way for applications inside wasm to talk to the gc at all yet
<RX14> which is exactly why wasm can't access the dom
<RX14> and you can't use bdwgc because bdwgc needs to look at the stack
<RX14> and in wasm you can't do that
<FromGitter> <ylluminate> right, but since emscripten goes to js, there's no need to pull gc considerations into the discussion until that end of emscripten and webasm proper have matured
<RX14> (i think their VM design has the stack not be in memory)
<Papierkorb> ylluminate, right now, a webasm program simply acquires more heap space. And then it can do whatever with it, and it has to manage it itself
<FromGitter> <ylluminate> i think we're talking about different things here...
<Papierkorb> ylluminate, this "gimme more memory" is quite like the sbrk(2) syscall
<RX14> @ylluminate maybe there's an emscripten specific gc api
<RX14> but I doubt it
<FromGitter> <ylluminate> empscripten CAN go to webasm, but for the time being it converts to javascript
<Papierkorb> it compiles to asm.js
<Papierkorb> Which isn't exactly JS, it just "happens to" be executable like normal JS
<Papierkorb> Such transpiled programs don't compile to "normal" JS code at all
<Papierkorb> So it too does its own memory management
<ryan_> Looking at this https://github.com/crystal-lang/crystal/issues/5173 how would I go about getting an Array to use each_slice?
<FromGitter> <ylluminate> hmmm
<RX14> doesn't array have each_slice?
<RX14> yes it does
csk157 has quit [Ping timeout: 240 seconds]
Ven`` has joined #crystal-lang
<RX14> looking at the error
<RX14> you see there exists an each_slice which takes an Int
<RX14> the error tells you the type you're trying to pass in here: no overload matches 'Array(String)#each_slice' with type (Int32 | String)
<RX14> so somehow lines can be a String or an Int32
<ryan_> `lines = 700`
<RX14> and you need to find out why (i can't see that code)
<RX14> and fix it
<ryan_> Ah, 1 sec
<RX14> learning to read error messages is pretty much step 1 of crystal development
Ven`` has quit [Client Quit]
<Papierkorb> s/crystal//
<ryan_> s/crystal development/life/
<FromGitter> <bew> life would be much simpler if we had error messages to read when we do sth wrong...
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
faustinoaq has quit [Quit: IRC client terminated!]
<FromGitter> <johnjansen> the world of ruby is so full of mixed types that no-one knew about
Creatornator has joined #crystal-lang
<FromGitter> <johnjansen> @bew you need the latest version of `self` ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a207a3d540c78242d6ba271]
<FromGitter> <bew> ah finally a message, thank you!! x)
<FromGitter> <ylluminate> so RX14 & Papierkorb, interestingly kripken is under the impression that the current crystal gc should work as part of the language runtime: https://github.com/WebAssembly/binaryen/issues/1312#issuecomment-348327133
<Papierkorb> > the only tricky thing being roots on the stack.
<RX14> lol
astronavt has joined #crystal-lang
<RX14> exactly
<FromGitter> <ylluminate> thanks for chiming in there RX14
<Papierkorb> lots of roots on the stack? did you mean We have tons of stacks = roots?
<RX14> no
<RX14> we have lots of roots per stack
<RX14> multiple stacks is just a smaller detail
<RX14> if it works on one stack THEN you worry about fibers
<Papierkorb> Which may also break with webasm, as iirc you can't move the stackpointer, or allocate a new stack
astronavt has quit [Ping timeout: 252 seconds]
<RX14> as i said
<RX14> getting it to work without fibers would be a huge achievement
<RX14> worry about that later
<FromGitter> <paulcsmith> I think that makes sense. You could still do a *lot* without fibers
<FromGitter> <paulcsmith> I'm sure it would still be a fair amount of work to get to that point though
<FromGitter> <sdogruyol> @paulcsmith good job with Lucky 👍
<FromGitter> <paulcsmith> Thanks @sdogruyol :D
alex`` has quit [Quit: WeeChat 1.9.1]
ryan_ has quit [Ping timeout: 260 seconds]
aroaminggeek has joined #crystal-lang
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
olbat has quit [Ping timeout: 240 seconds]
astronavt has joined #crystal-lang
faustinoaq has joined #crystal-lang
astronavt has quit [Ping timeout: 250 seconds]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <crisward> How long is 0.24.0 staying in pre-release? It's been a month now. Is it the LLVM issue slowing things down?
Creatornator has joined #crystal-lang
<RX14> it just needs time
<RX14> the LLVM issue is essentially solved we thing with my static build
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> i thought i'd have time to fixup the IO pr today
<RX14> but i got distracted :(
snsei has joined #crystal-lang
astronavt has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
astronavt has quit [Ping timeout: 250 seconds]
Ven`` has joined #crystal-lang
snsei has quit [Remote host closed the connection]