jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.9.1 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
Renich has quit [Ping timeout: 250 seconds]
fowlduck_ has quit [Read error: Connection reset by peer]
Renich has joined #crystal-lang
fowlduck has joined #crystal-lang
shama has quit [Ping timeout: 264 seconds]
globalkeith has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
shama has joined #crystal-lang
shama has quit [Remote host closed the connection]
slash_away is now known as slash_nick
victor_lowther_ has quit [Ping timeout: 264 seconds]
emmanueloga has quit [Ping timeout: 264 seconds]
victor_lowther_ has joined #crystal-lang
emmanueloga has joined #crystal-lang
elia has quit [Quit: Computer has gone to sleep.]
waterlin1 has joined #crystal-lang
waterlink has quit [Ping timeout: 240 seconds]
A124 has quit [Ping timeout: 256 seconds]
ozra has quit [Ping timeout: 250 seconds]
waterlin1 has quit [Ping timeout: 240 seconds]
fowlduck has quit [Read error: Connection reset by peer]
fowlduck has joined #crystal-lang
trapped has joined #crystal-lang
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
trapped has joined #crystal-lang
waj- has joined #crystal-lang
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
trapped has joined #crystal-lang
trapped has quit [Client Quit]
waterlink has joined #crystal-lang
Ven has joined #crystal-lang
waterlink has quit [Ping timeout: 272 seconds]
elia has joined #crystal-lang
elia has quit [Client Quit]
globalkeith has joined #crystal-lang
elia has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
daveshah has joined #crystal-lang
Ven has joined #crystal-lang
daveshah has quit [Remote host closed the connection]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
trapped has joined #crystal-lang
A124 has joined #crystal-lang
elia has quit [Excess Flood]
n1ftyn8_ has quit [Ping timeout: 260 seconds]
n1ftyn8_ has joined #crystal-lang
elia has joined #crystal-lang
hohenfall has joined #crystal-lang
Cidan has joined #crystal-lang
ozra has joined #crystal-lang
ozra_ has joined #crystal-lang
daveshah has joined #crystal-lang
ozra has quit [Ping timeout: 240 seconds]
ozra_ has quit [Ping timeout: 272 seconds]
Sadin has joined #crystal-lang
ozra_ has joined #crystal-lang
ozra_ has quit [Ping timeout: 256 seconds]
elia has quit [Quit: (IRC Client: textualapp.com)]
Sadin has quit [Quit: Leaving]
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ozra has joined #crystal-lang
ozra_ has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ozra has quit [Ping timeout: 256 seconds]
ozra_ has quit [Ping timeout: 272 seconds]
Sadin has joined #crystal-lang
Ven has joined #crystal-lang
havenn has joined #crystal-lang
havenn has quit [Changing host]
havenn has joined #crystal-lang
havenwood has quit [Read error: Connection reset by peer]
havenn is now known as havenwood
adam_ has quit [Ping timeout: 272 seconds]
adam_ has joined #crystal-lang
imperator has joined #crystal-lang
trapped has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shama has joined #crystal-lang
<imperator> hello
<imperator> does crystal have a repl?
<jhass> no
<jhass> REPL is kinda hard to do for a language like this
<jhass> some use http://carc.in as one I guess
<imperator> jhass, that's pretty cool, thanks
ozra_ has joined #crystal-lang
ozra_ is now known as ozra
<imperator> any facility for OS detection?
<jhass> imperator: compile time you can do ifdef linux / ifdef darwin
<imperator> any way for me to know which compile time flags are available?
<jhass> not really
<jhass> pretty much just i686, x86_64, linux, darwin atm iirc
<jhass> and your own that you pass via -D
<imperator> right, time to port sys-uname ;)
<jhass> those of course are all parsed from calling uname compile time :P
fowlduck has quit [Remote host closed the connection]
<imperator> i guess I'm doing it wrong: https://gist.github.com/djberg96/513bf4a962b09d983b10
<asterite> imperator: uname receives a pointer to the struct
<asterite> try doing `LibC.uname(out buf)` (without the line above that does buf = ...)
<jhass> imperator: also simply raise Errno.new("uname") to raise errno based failures
<imperator> ok, updated gist, but segfaulting now
<jhass> I guess it wants a pointer to preallocated memory?
<asterite> What does this print to you? https://gist.github.com/asterite/9f9456f2140065da2e8b
<asterite> For me it prints 1280, while sizeof(Utsname) gives me 40, so there's something wrong there
<imperator> yeah, 1280
<imperator> guess i defined it wrong
<jhass> the stuff in the manpages usually has little to do with the actual definition
sdogruyol has joined #crystal-lang
<asterite> Yes, that got me too. For me it says "sysname Name of the operating system implementation"
<asterite> The obvious choice would be char*, but I guess it's more something like char[some_number]
<imperator> 256 for osx
globalkeith has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<imperator> how do you specify a char array? tried char[256], didn't work
<jhass> UInt8[256]?
<jhass> or LibC::Char[256] I guess
<jhass> (essentially the same)
<imperator> thanks
<imperator> making progress, gist updated
<jhass> imperator: String.new(buf.sysname)
<sdogruyol> hey there
<imperator> jhass, in ./uname.cr:22: no overload matches 'String::new' with types StaticArray(UInt8, 256)
<jhass> huh
<jhass> asterite: ^ we should fix that sometime
<jhass> imperator: it's 0 terminated, right? String.new(buf.sysname.to_unsafe) for now
<imperator> jhass, that worked, thanks!
<imperator> yeah, should be
<imperator> updated gist, final version up :)
<imperator> jhass, asterite - thanks!
<jhass> imperator: I'd perhaps memoize the strings
<imperator> i was wondering if i could just freeze the whole object
daveshah has quit [Remote host closed the connection]
<jhass> mh no, no such explicit construct
daveshah has joined #crystal-lang
<imperator> what's a good way to do the memoization? just create instance vars in the constructor and use ||= ?
<imperator> or does crystal have a better way?
<imperator> updated gist
<jhass> for now just ||= like you would in Ruby
<jhass> the next bigger compiler version will have you to declare them explicitly
<jhass> yeah that works I guess
<imperator> guess i coulda set them all in the constructor, works either way
<jhass> mh, yeah
<jhass> it's just that that String.new copies the buffer and also has to find the 0 byte
<imperator> hrm, no attr_reader shortcut?
<sdogruyol> imperator: property
<jhass> imperator: getter, getter?, getter!, setter, property, property?, property!
<jhass> ? generates foo? methods, ! generates foo? methods and foo methods calling .not_nil!
<imperator> nice, thanks
<imperator> gist updated :)
<jhass> cool
<jhass> mh, LibC::SIZE is probably not the best name ;P
<imperator> taken?
<imperator> didn't see a warning
<jhass> not yet, but I can see it conflicts easily or is at last ambiguous ;)
<imperator> changed it to BUFSIZE :)
<jhass> shouldn't need the @[Link("c")] btw
<jhass> UTSNAME_SIZE ?
<imperator> oh, default?
<jhass> basically
<jhass> libc is always linked
<imperator> cool, thanks
<jhass> oh, I guess I didn't realize you nested the lib into the class, hm
<imperator> off to lunch, thanks for all your help
<jhass> yw, have a good one
globalkeith has joined #crystal-lang
greengriminal has joined #crystal-lang
<jhass> it was just posted, I think we all got the notification ...
<sdogruyol> i dont think that everyone is on bountysource here
<jhass> they commented on their GH ticket though
<sdogruyol> i havent seen the GH ticket
<jhass> it's linked from your link
<sdogruyol> oh
* imperator needs some vim syntax highlighting
Sadin has quit [Ping timeout: 250 seconds]
<jhass> ?vim imperator
<DeBot> imperator: You can find a vim plugin for Crystal at https://github.com/rhysd/vim-crystal
<imperator> thanks
<sdogruyol> asterite: i really wonder did you ever consider making Crystal immutable by default?
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
trapped has joined #crystal-lang
shama has quit [Read error: Connection reset by peer]
shama has joined #crystal-lang
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
trapped has joined #crystal-lang
sdogruyol has quit []
globalkeith has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
globalkeith has joined #crystal-lang
globalkeith has quit [Client Quit]
globalkeith has joined #crystal-lang
globalkeith has quit [Client Quit]
sooli has joined #crystal-lang
Sadin has joined #crystal-lang
Sadin has quit [Ping timeout: 250 seconds]
sooli has quit [Ping timeout: 250 seconds]
HakanD has joined #crystal-lang
globalkeith has joined #crystal-lang
Sadin has joined #crystal-lang
Sadin has quit [Ping timeout: 250 seconds]
daveshah has quit [Remote host closed the connection]
shama has quit [Read error: Connection reset by peer]
shama has joined #crystal-lang
greengriminal has quit [Quit: Leaving]
HakanD has quit [Quit: Be back later ...]
trapped has quit [Quit: Textual IRC Client: www.textualapp.com]