<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…]
<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>
<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 ;-)
<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
<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