leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
kyrylo has joined #crystal-lang
leafybasil has quit [Ping timeout: 255 seconds]
cina has joined #crystal-lang
<cina>
crystal beginner question: how do I cast a string to integer? str.to_i works in Ruby, but not in Crystal. Or if str is always a String, how do I parse the integer in a new variable?
<cina>
oh ok, in Go we have backquotes, I thought there might be a convenient way to do it in crystal as well
<jhass>
IME it's very rare that you need a string with a lot of #{...} things in it
<cina>
true, me too, I thought of this because I was running a tmux command, tmux formatting has a similar syntax, e.g. tmux ls -F '#{session_name}:#{window_index}'
<cina>
now I see what you meant by copying the method invokation... so in case of no_interpol(gets), the string being escaped is just "gets", so we are basically returning the result of gets without any changes made to it
<BlaXpirit>
jhass, does that mean if I store a number in it that happens to match some memory location, it won't be cleared?
<BlaXpirit>
i dont get it
<jhass>
ugh, no idea but I doubt it
<BlaXpirit>
hm actually it kinda makes sense. why would i store a number inside Pointer(Reference)
<BlaXpirit>
and Pointer(Value) wouldn't count for GC
<BlaXpirit>
i just wasn't expecting GC to work even with the lowest-level data type
<asterite>
hi vegai
Dreamer3 has joined #crystal-lang
<asterite>
In fact for pointers of primitive types like Int32 and so on we should be using malloc_atomic so the GC doesn't scan pointers there. And the `clear` shouldn't be done in that case. Right now it's doing the safest thing but not the fastest
dbackeus has quit [Remote host closed the connection]
dbackeus has quit [Remote host closed the connection]
waj has quit [Ping timeout: 260 seconds]
waj_ is now known as waj
<BlaXpirit>
in order to implement an efficient iterator, i need access to an object's internals. is there any solution to this?
<jhass>
you can access instance vars with obj.@foo, but usually there's a better way
<jhass>
like exposing the efficient operations as regular (delegating) methods or handing some internal explicitly to the iterator
<BlaXpirit>
jhass, so instance vars aren't private????
<jhass>
well, kinda, .@foo is more meant for introspection
<jhass>
it's a big fat "I'm nasty" sign to use them
<jhass>
hence they don't appear in the docs or anything
blue_deref has joined #crystal-lang
sleeper_ is now known as sleeper
waj has quit [Quit: waj]
waj has joined #crystal-lang
zamith has quit [Quit: Be back later ...]
<asterite>
BlaXpirit: in a language where you can reopen a class and expose an instance variable, having a syntax for accessing them "in a hurry" isn't that dangerous, I think. They are "public" now just temporarily, they'll probably only be accessible from within the same class in the future
<BlaXpirit>
asterite, that's ok, but then how do i make an iterator? even c++ has friend classes
<asterite>
an iterator over what?
shama has joined #crystal-lang
waj_ has joined #crystal-lang
waj has quit [Ping timeout: 240 seconds]
waj_ is now known as waj
<dzv>
perhaps disable access to obj.@var when --release is passed?
<jhass>
I'd still love something like macro method_missing that overloads on arguments, class Object macro_method instance_variable_get(name); @{{name.id}}; end; end; class Foo; def initialize; @foo = 1; @bar = 2; end; end; end; Foo.new.instance_variable_get :foo; Foo.new.instance_variable_get :bar; -> generates Foo#instance_variable_get_tmp123, Foo#instance_variable_get_tmp234
<jhass>
something into that direction
strcmp1 has joined #crystal-lang
waj_ has joined #crystal-lang
waj has quit [Ping timeout: 265 seconds]
waj_ is now known as waj
NeverDie has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
sleeper is now known as sleeper_
dbackeus has joined #crystal-lang
waj_ has joined #crystal-lang
waj has quit [Ping timeout: 260 seconds]
waj_ is now known as waj
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
NeverDie has joined #crystal-lang
dbackeus has quit [Remote host closed the connection]
dbackeus has joined #crystal-lang
waj_ has joined #crystal-lang
waj has quit [Ping timeout: 240 seconds]
waj_ is now known as waj
blue_deref has quit [Quit: bbn]
sleeper_ is now known as sleeper
sleeper is now known as sleeper_
NeverDie has quit [Max SendQ exceeded]
NeverDie has joined #crystal-lang
waj_ has joined #crystal-lang
waj_ has quit [Remote host closed the connection]
waj has quit [Ping timeout: 245 seconds]
NeverDie has quit [Max SendQ exceeded]
leafybasil has joined #crystal-lang
NeverDie has joined #crystal-lang
kyrylo has quit [Remote host closed the connection]
strcmp1 has quit [Quit: Leaving]
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: http://git.io/v3izp
<crystal-gh>
crystal/master 5d398a0 Ary Borenszweig: Some refactors, optimizations and simplifications in bcrypt