asterite changed the topic of #crystal-lang to: #crystal-lang The Crystal programming language | http://crystal-lang.org | Crystal 0.6.1 | 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
ponga has joined #crystal-lang
ponga has quit [Ping timeout: 244 seconds]
wanderer_ has quit [Quit: Page closed]
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/vekGi
<crystal-gh> crystal/master 6f3037e Ary Borenszweig: Doc: show the locations where a type is defined
<crystal-gh> crystal/master f0ae324 Ary Borenszweig: Better error message for failed `be_a` expecation
<crystal-gh> crystal/master ba121ed Ary Borenszweig: Documented Number, and cast to self's type in `significant` and `round` methods.
asterite has joined #crystal-lang
<asterite> >> StringIO{1, 2, 3}
<DeBot> asterite: #<StringIO:0x8E49FC0 @buffer=Pointer(UInt8)@8E4BF78, @bytesize=3, @capacity=64, @pos=0>
<asterite> >> StringIO{1, 2, 3}.to_s
<DeBot> asterite: "123"
asterite has quit [Ping timeout: 246 seconds]
<a5i> What is StringIO ?
havenwood has joined #crystal-lang
<a5i> jhass, I'm willing to go some hardship(i think) to get CrystalEval working
<travis-ci> manastech/crystal#2178 (master - b09177f : Ary Borenszweig): The build passed.
<jhass> a5i: a string with an IO like interface
<a5i> jhass, ah, hey can I see your Arch script?
<a5i> for CrystalEval
<a5i> All that just to create a CrystalEval for the Bot>
<jhass> well you don't have to do a chroot
<jhass> er, an arch chroot
<jhass> but a chroot of some sort that contains a crystal compiler
<jhass> it runs arbitrary code from an untrusted source
<jhass> gotta take some care
<a5i> What if
<a5i> Command inpput -> writes to file -> run code and save the output, -> return it
<jhass> that's what it does
<jhass> only in a safe way
<a5i> ah
<a5i> Ima try it
<a5i> How do we read and write files in Crystal?
<a5i> thanks
<a5i> >> "ab" - "b"
<DeBot> a5i: Error in line 3: undefined method '-' for String
<a5i> How do we get shell command output?
<a5i> like system(cmd) but I cant use that since I just get True
<jhass> >> `ls ..`
<DeBot> jhass: "crystal\n"
<a5i> o
<a5i> yay now it works :P
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vekg2
<crystal-gh> crystal/master 02021d4 Ary Borenszweig: Updated README status
<crystal-gh> crystal/master 7ad206a Ary Borenszweig: Added a very basic Contributing guide
<travis-ci> manastech/crystal#2179 (master - 7ad206a : Ary Borenszweig): The build was broken.
<a5i> >> 1e10
<DeBot> a5i: 1e+10
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
ponga has joined #crystal-lang
ponga has quit [Ping timeout: 250 seconds]
ponga has joined #crystal-lang
Infathome has joined #crystal-lang
Infathome has left #crystal-lang ["Leaving"]
<ponga> >> p rand(6)
<DeBot> ponga: 0
<ponga> >> p rand(6)
<DeBot> ponga: 2
<ponga> gud
ponga has quit [Quit: Leaving...]
bcardiff has joined #crystal-lang
_whitelogger has joined #crystal-lang
canhtak has joined #crystal-lang
<ponga> hey guys
<ponga> puts "#{input} has been chosen" goes like
<ponga> input
<ponga> has been chosen
<ponga> two seperate lines
<ponga> it works fine in ruby but not in crystal
<ponga> >> a= "hi"; puts "#{a} there"
<DeBot> ponga: hi there
<ponga> hm
<ponga> why is it not working for me
<ponga> oh i see i didn't chomp
<ponga> jhass: how do i gets.chomp in crystal
<ponga> it says i can't chomp Nil
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
havenwood has quit []
Ven has joined #crystal-lang
<ponga> anyone here
<ponga> got an issue
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
<ponga> anyone
<jhass> ponga: well, check it's not nil first ;)
<ponga> jhass: its ' a= gets.chomp ' of course its empty at the begining
<ponga> i tried doing >> a = ""
<jhass> it's gets that may return nil
<ponga> jhass: its two line code
<ponga> foo = gets.chomp
<ponga> puts foo
<ponga> im not sure how to work around this
canhtak has quit [Quit: canhtak]
<jhass> foo = gets; if foo; puts "Hi #{foo.chomp}"; else; puts "EOF"; end;
<ponga> jhass: so i can't simply gets.chomp ?
<jhass> no, as said gets may return nil
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sillesta has joined #crystal-lang
<ponga> jhass: how do i avoid it
<jhass> didn't I just show how?
<ponga> is that how you do it
<jhass> did you try it?
<ponga> jhass: my main issue was to gets.chomp the input to lead to get into menu
<ponga> thanks i solved it by if foo
<ponga> foo = foo.chomp
<ponga> else
<ponga> end
<jhass> empty else branches don't have to be specified
<ponga> ok
<jhass> and if you want it that way you can foo = gets.try &.chomp
<ponga> so its crystal's style of 'let me make sure it is safe'
<jhass> yeah
<ponga> no here document in crystal yet
<ponga> gotta do the manuel way
<jhass> a " literal can be multi-line though
<jhass> >> "foo" "bar"
<DeBot> jhass: Syntax error in eval:3: unexpected token: DELIMITER_START
<ponga> really ?
<jhass> okay, that one wasn't ported over :P
<jhass> yeah
<ponga> so i could just go
<ponga> " hi there
<ponga> im very fine
<ponga> how are you
<ponga> "
<ponga> like this?
<jhass> should do I think
<ponga> oh <<-
<jhass> should do without the - I think
<ponga> k
sandelius has joined #crystal-lang
<ponga> jhass: do i need to add options to build cr to exe that runs in windows
<jhass> that won't work properly yet
<ponga> i built it in OSX, tried to run it in win7 and failed
<ponga> :(
<ponga> so no windows build support yet?
<jhass> highly experimental and not in the version you have
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jua_ has joined #crystal-lang
canhtak has joined #crystal-lang
<ponga> jhass: do you remember the name of ruby the file equivelant to crystal.exec python.exec
<ponga> i see erb gem irb rake rdoc ri in the \bin
<jhass> what?
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sandelius has joined #crystal-lang
canhtak has quit [Quit: canhtak]
<ytti> what are the plans for package manager?
<ytti> copy gem?
<jhass> not too many plans yet
<jhass> some preliminary thing is there that clones repos form github and symlinks them into the right place
<jhass> personally I'd still prefer something like pip/cpan/rubygems, but community seems to tend towards go-style stuff
<ytti> but long term, are goals for centralized or distributed
<ytti> i really dislike for example what golang does
<ytti> i strongly feel centralized is the way to go
<ytti> ohh there is fair bit of discussion on that
<jhass> yes
Ven has joined #crystal-lang
<jhass> you may want to weigh in ;)
<jhass> we should rebrand "centralized" to "repository" though
<jhass> I'd just like a lookup registry, having multiple of them is fine
<ytti> or maybe market it as decentralized with authorative reposotiory :/
<ytti> repository
<ytti> if it is there, you 'own' the package name, by convention
canhtak has joined #crystal-lang
<jhass> any way, as discussion stands I think we have to bootstrap that externally
sandelius has quit [Quit: Textual IRC Client: www.textualapp.com]
leafybasil has quit [Remote host closed the connection]
canhtak has quit [Quit: canhtak]
a5i has quit [Quit: Connection closed for inactivity]
canhtak has joined #crystal-lang
Ven has quit [Ping timeout: 255 seconds]
Ven has joined #crystal-lang
<ytti> jhass, does crystal has same property, that #match /foo/ is potentially ambiguous, and what would be lost, if it were not?
<jhass> no idea actually
<jhass> gotta wait till asterite drops in
<ytti> (//) is so fugly
<jhass> but he said once that he's against syntax warnings
<jhass> either the parser should be smart about it or throw an error
<jhass> like shadowing locals with block arguments, it was an error and we changed it to be allowed and not even warn
<jhass> ruby warns on it
<ytti> that really annoys me, let me dig my own grave
<ytti> i know (sometimes) what i'm doing
<jhass> yeah
<ytti> need to come up with inconvenient variable names just to get rid of warning
<ytti> especially in libraries which pass itself in block as argument
<ytti> like net/ssh
<jhass> yeah, it's why we removed the error
leafybasil has joined #crystal-lang
leafybasil has quit [Ping timeout: 245 seconds]
wanderer_ has joined #crystal-lang
canhtak has quit [Quit: canhtak]
<wanderer_> jhass: just saw that this function `make_absolute_and_expand` is unnecessary in its whole, because `File.expand_path` prepends the working directory if the passed path isn't absolute
canhtak has joined #crystal-lang
<jhass> nice catch
<wanderer_> haven't tested it yet, but replacing `make_absolute_and_expand` directly with File.expand_path should work if I'm not mistaken, I'm atm having problems with it on windows as it's not expanding ".."
a5i has joined #crystal-lang
<wanderer_> jhass: btw why is expand_path actually implemented, doesn't a call to LibC.realpath on unix suffice?
<jhass> >> File.expand_path("~/a")
<DeBot> jhass: "/home/crystal/a"
<jhass> >> LibC.realpath("~/a")
<DeBot> jhass: Error in line 3: wrong number of arguments for 'LibC#realpath' (1 for 2)
<jhass> heh
<jhass> anyway, it does more
<jhass> also iirc realpath is FS bound
<wanderer_> >> a :: UInt8[260]; LibC.realpath("~/a", a.buffer); String.new(a.buffer)
<DeBot> wanderer_: "/home/crystal/~"
<jhass> oO
<jhass> that's some weird output
<jhass> oh, right, realtive to pwd
<wanderer_> it doesn't seem to understand ~, but only . and ..
<jhass> yeah, and strips a since it doesn't exist
<jhass> >> File.expand_path "~root"
<DeBot> jhass: "/home/crystal/~root"
<jhass> heh, so that's missing :
<jhass> :P
<wanderer_> maybe it'd work to replace a possible ~ and then just use realpath()?
<wanderer_> then again I don't know how linux paths work
<jhass> >> File.expand_path "/home/../nope"
<DeBot> jhass: "/nope"
<jhass> >> LibC.realpath "/home/../nope", out path; String.new(path)
<DeBot> jhass: Error in line 3: wrong number of arguments for 'String#new' (1 for 0)
<wanderer_> >> a :: UInt8[260]; LibC.realpath("/home/../nope", a.buffer); String.new(a.buffer)
<DeBot> wanderer_: "/nope"
<jhass> oh, mh
<jhass> anyway, probably not worth it
<wanderer_> well, it's already implemented and seems to work, was just wondering why the duplicate work
<jhass> >> File.expand_path "a/../b", "/tmp/bar"
<DeBot> jhass: "/tmp/bar/b"
<wanderer_> I've read that on linux there's no general way to get the path of the executable? how does gcc for example finds its include files? "../include/" wouldn't work if the working directory is not gcc's folder, would it?
<jhass> gcc has a built in search path afaik
<jhass> there's probably some variable to set it too
<jhass> CLI flag to amend it is -I
<jhass> and yeah, man gcc, search for CPATH
<jhass> so -I, CPATH, compiled in default
<wanderer_> and crystal finds its stdlib via a shell script when it's started from some other working directory?
<jhass> both
<jhass> it too has a compiled in default
<jhass> set via CRYSTAL_CONFIG_PATH during compile time
<jhass> and that default can be overridden (not amended) with CRYSTAL_PATH
<jhass> I'm still trying to convince asterite to let CRYSTAL_PATH amend the default and have a -I CLI flag I guess
<wanderer_> -I isn't implemented yet?
<jhass> don't think so
<wanderer_> the normal way is one default path and addable ones via -I, I guess
<jhass> the three stage model is common and useful
<jhass> ruby has it too
<wanderer_> ah, k
<jhass> 1) default to work in unconfigured environment (compiled in default) 2) override/amend defaults in configured environment (environment variable) 3) override/amend configured environment on invocation
<wanderer_> On Windows you'd simply retrieve the path the executable is in right now
canhtak has quit [Quit: canhtak]
<jhass> yes, since windows follows an appdir approach, not something like the FHS
<jhass> you can find appdir distros on linux too, I think gobolinux was one for example
<jhass> OS X actually does a mixture
<jhass> it has the FHS for posix compliance but actually installs apps into appdirs
<jhass> but I think the 3 stage model is a lot more flexible, even if you'd guaranteed to be installed to an appdir
<wanderer_> ah, yes, linux mostly has its executables in /bin/, docs in /share/, etco
<wanderer_> etc.*
<jhass> you would just choose a different (or additional) default for 1) when left unspecified during compile time I guess
Ponder has joined #crystal-lang
<Ponder> Hi
<jhass> hey
<Ponder> I know Crystal is fast as it is now, but how much faster will it get over the releases?
<jhass> probably not too significantly, the compiler speed is already pretty optimized and the executable speeds we get via LLVMs optimizations
<jhass> maybe a different GC someday will make a difference
<jhass> do you have a feeling that there's still much room for improvement?
<Ponder> Well, being in it's pre-alpha stages at version 0.6.1, yes
<jhass> so no actual code you have that runs slow :)
<Ponder> How different would Crystal be without a GC, and isnt it optional?
leafybasil has joined #crystal-lang
<jhass> and actually we're officially in alpha as of yesterday :D
<Ponder> :O
<jhass> the GC is not easily taken out (at least yet)
<jhass> the alpha stage mostly refers to language bugs and language design
<Ponder> I thought if you set prelude to empty, it wouldnt initalize it
<jhass> crystal generates LLVM IR, so that side is pretty much as good as it gets already I said
<jhass> *I'd say
<Ponder> I see
<jhass> mh, I never tried
<Ponder> ping dom96
<jhass> but I wouldn't even know how to free an object :P
asterite has joined #crystal-lang
<dom96> Ponder: hi, what's up?
<Ponder> dom96 arent you from Nim?
<asterite> Ponder: most of the optimizations right now are done by LLVM, but we can still do our own optimizations. For example escape analysis
<dom96> indeed
canhtak has joined #crystal-lang
<asterite> Or, as jhass said, use a specialized GC. There's still room for improvement
<jhass> I just wouldn't say it's a pressing issue, it's pretty decent already
<Ponder> asterite, that sounds great, Do you know when the next release of Crystal is?
<asterite> jhass: exactly. Even Go is slower than Crystal in many aspects but it's already decent so I think they say "It' ok like that, let's focus on other things"
<Ponder> I heard it would include non-blocking IO and lightweight processes
<asterite> Ponder: Yes, that's already on HEAD
<a5i> asterite: I still cant compile HEAD :(
<asterite> because of the memory issue?
<a5i> asterite: No, outdated verion of libpcl
<asterite> Ah... we'll include a compatible one in the next release. I guess right now you won't be able to try it :(
<a5i> thank god, when is the next release if you may say?
<asterite> After at least two weeks
<dom96> Ponder: why do you ask?
<Ponder> dom96, I swear I've seen you there
<Ponder> I don't remember though
<asterite> I rememebr dom96 is pretty active on the Nim forums
<asterite> (I read them frequently)
<dom96> Ponder: Yeah, i'm one of the main devs.
<Ponder> dom96, knew it :)
<a5i> You guys over at nim have this guy who totally hates Rust
<jhass> asterite: are you going to fix IO.select first or do I have to start crystal-posix-io? :P
<asterite> We'll fix it. Or, better said, waj will probably fix it :-P
Ponder has quit [Quit: Page closed]
<dom96> a5i: who are you referring to?
<asterite> Or... maybe we won't have IO.select and you'll have to use Channel.select or something like that. We still don't know, waj has a more clear overall picture
* jhass creates repo...
<asterite> jhass: no, no, there's still time for discussion! :-P
asterite has quit [Quit: Page closed]
<jhass> and then he drops out...
<a5i> dom96: Jason Livesay?
<dom96> a5i: I haven't seen him since he posted that one rather rude thread.
<a5i> dom96: That's good, and yeah agreed on the latter xP
weskinner_work has joined #crystal-lang
weskinner_work has quit [Ping timeout: 265 seconds]
<wanderer_> when compiling spec/compiler/compiler_spec.cr and the `require "../src/compiler/crystal/**"` is encountered, then fullname seems to be equal to for example "/home/ubuntu/crystal/spec/../src/compiler/crystal//command.cr"
<wanderer_> however, printing `result` in find, line 12, it contains "/home/ubuntu/crystal/src/compiler/crystal/command.cr" instead
<wanderer_> oh.. I totally overlooked the `files_accumulator << File.expand_path(file)`...
<jhass> happy rubberducking!
<wanderer_> that's what I was actually looking for, don't know how I could not see that
<jhass> yw
<wanderer_> thanks :P
<jhass> IRC, Interactive Rubber duCK :P
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
sandelius has joined #crystal-lang
canhtak has quit [Quit: canhtak]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<wanderer_> jhass: PROGRAM_NAME isn't reliable on linux then, is it?
Ven has joined #crystal-lang
<jhass> how so?
<jhass> well, it may be a symlink I guess
<jhass> >> PROGRAM_NAME
<DeBot> jhass: "/tmp/crystal-run-eval.AdIwf1"
<wanderer_> 1. it could be a full path or just a single filename 2. I've read that its correctness depends on the caller
<wanderer_> and that it's just a convention
<wanderer_> not a requirement
havenwood has joined #crystal-lang
<jhass> eh, well, I guess so
<wanderer_> jhass: when is code like `STDIN = CFileIO.new(LibC.stdin)` and `ARGV = (ARGV_UNSAFE + 1).to_slice(ARGC_UNSAFE - 1).map { |c_str| String.new(c_str) }` actually executed, what is its scope and can local variables be used there or "out xxx"?
<jhass> I'm not sure I quite follow
<jhass> the lexical scope of constants is global
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass> I'm not follow where you want to use an out parameter in one of those two expressions
<wanderer_> in argv.cr I want to add `argv = LibWin32.wcommandlinetoargv(LibWin32.wgetcommandline, out argc); ARGV = Slice.new(argc - 1) { |i| String.new((argv + i + 1).value) }`
<jhass> and that doesn't work?
<wanderer_> I get "undefined local variable or method 'argc'"
<jhass> mh
<jhass> sounds like a bug to me
<jhass> but interesting API, I'd expect the array to be an out parameter and the count to be returned
<jhass> or let's say I'm used to that way around
a5i has quit [Quit: Connection closed for inactivity]
<wanderer_> it's kind of a weird API function, it's one of few on windows that allocate the buffer themselves
<wanderer_> is the commandline passed to the executable on unix always globbed?
<jhass> "globbed"?
<wanderer_> wildcards expanded
<wanderer_> e.g. "*.*"
<jhass> yeah, wildcards are a shell thing
<jhass> they're expanded by the shell
<jhass> and thus meant literal in argv
<wanderer_> so what if you'd actually want to pass "*.*" itself to the program?
<jhass> that depends on the shell, but quoting it usually works
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ponga has quit [Quit: Leaving...]
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shama has joined #crystal-lang
c355E3B has joined #crystal-lang
c355E3B has quit [Client Quit]
sandelius has joined #crystal-lang
wanderer_ has quit [Quit: Page closed]
asterite has joined #crystal-lang
<asterite> !memo wanderer_ constants can't access variables, they have their own scope. Use a begin ... end block and declare the argc and argv variables inside it, like here: https://github.com/manastech/crystal/blob/master/src/crypto/md5.cr#L74
<DeBot> asterite: Added memo for wanderer_.
<jhass> asterite: mh, any strong reason for that?
<asterite> Yes, although now I can't remember it
<asterite> Ah, well, the reason is that constants are lazy
<asterite> When you do FOO = Foo.instance that doesn't get executed immediately, only when you use that constant
<asterite> Because of this, order of initialization of constants start to matter more... but... maybe we can try having constants not be lazily typed
sandelius has quit [Quit: Textual IRC Client: www.textualapp.com]
weskinner_work has joined #crystal-lang
<asterite> In any case, having a global constant depend on a local variable seems weird to me
<jhass> I think that would be awesome, at least having another error would be great though, like "Can't assign constant from local variable"
wanderer_ has joined #crystal-lang
<jhass> I wouldn't say so, especially on the top level
<asterite> Yes, the error message can be improved :)
<weskinner_work> trying to figure out: "can't execute `(return {:none, :nil}) === __temp_172` at /home/william/play/ctf/src/main.cr:203:7: `return {:none, :nil}` has no type"
<weskinner_work> ignore the :nil
<weskinner_work> should just be nil
<jhass> protip: Github has Crystal syntax highlighting! name your gist file something.cr
<weskinner_work> daumn!!
<weskinner_work> movin' on up!
asterite has quit [Ping timeout: 246 seconds]
<jhass> mh, well, that snipped doesn't reproduce due to all the missing constants and stuff :/
<jhass> what's line 203 though?
<jhass> oh I see
<jhass> you have an empty when clause on line 17
<jhass> thus it parses as when(return ...)
<jhass> and thus transforms to e.type === (return ...)
<jhass> weskinner_work: ^
<jhass> should probably a parse error though
<weskinner_work> ahh!
<weskinner_work> thanks
<jhass> >> case 1; when return 2; end;
<DeBot> jhass: Error in line 3: can't return from top level
<wanderer_> jhass: so do constants get executed over and over again? are they like `#define`s?
<jhass> wanderer_: no
<jhass> it just means they're not typed if they're never accessed
<wanderer_> just once, but lazily?
<jhass> or probably not even generated
<jhass> yeah
<jhass> >> def foo; case 1; when return 2; end; end; foo
<DeBot> jhass: can't execute `(return 2) === __temp_168` at eval:3:28: `return 2` has no type (Exception)
<jhass> weskinner_work: ^ minimal code for your bug report ;)
<weskinner_work> :)
<wanderer_> so I need to put the winapi call inside of a begin-end-constant?
<jhass> wanderer_: yeah
asterite has joined #crystal-lang
<wanderer_> when my code looks like this `LibC.bla(out x); ABC = x.y` I refactor it to `ABC = begin; LibC.bla(out x); x.y; end;`
<wanderer_> what about `LibC.bla(out x); ABC = x.y; XYZ = x.z;`?
<asterite> For example if you don't use ARGV the program doesn't bother in creating an Array from argc/argv (but that's just a tiny fraction of the startup, so we might change the semantics to be more Ruby-like)
<asterite> wanderer_: Right, seems it can't be done right now
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/veYB7
<crystal-gh> crystal/master d2f5751 Ary Borenszweig: Fixed more cases of "void value expression"
<asterite> wanderer_: jhass: that fixes the "when return" thing
<jhass> weskinner_work: ^
<asterite> Ah, right :)
<jhass> happens ;)
<weskinner_work> asterite: ty
<wanderer_> asterite: would something like `A = begin ... end; B = begin ... use A ... end; C = begin ... use A ... end;` work?
<asterite> wanderer_: I think we can make it so that you can use local variables like in Ruby, I have to try
<wanderer_> asterite: http://pastebin.com/sxjhd0MQ
<wanderer_> that's the code I'd need
<asterite> Oh, you can always do ARGV_FULL = ... and put all of argv contents there, and then do PROGRAM_NAME = ARGV_FULL[0]; ARGV = ARGV_FULL[1 .. -1]
<asterite> Some extra memory allocations and slices, but it should work for now, until we change constants semantics
<asterite> Or you can use $global_variables for argc and argv, constants can access them. All of these solutions are ugly but should work for now
<travis-ci> manastech/crystal#2180 (master - d2f5751 : Ary Borenszweig): The build was fixed.
<jhass> ARGC, ARGV = begin; ...; {argc, argv}; end; won't work I guess?
<wanderer_> no, I've already tried that
<wanderer_> but putting everything in a constant and using that one is ok
<asterite> wanderer_: what was the problem with windows and generate_docs?
<wanderer_> btw. got some general question: 1. what's exactly a tuple and what is the difference between a tuple, a slice and an array? 2. what about a `String#[]?`?
<asterite> wanderer_: I'll hopefully document these soon, I'm slowly documenting the basic types
<asterite> A tuple is immutable, allocated on the stack and passed by value, so it's like a struct with N members that you can access with numbers instead of names
<asterite> and a Slice is just a struct that has a pointer and an associated length
<wanderer_> so a Slice is a part of an Array?
<wanderer_> and a Tuple is a stack array
<asterite> You can think Array is built on top of Slice (but instead it uses pointer and does its own bound checks, maybe because Slice didn't exist back then)
<asterite> A Tuple can't grow or shrink, nor it can be changed, so it's not like a stack array
<wanderer_> yeah, static stack array
<wanderer_> array = contiguous memory
<asterite> Ah, yes :)
<wanderer_> tuple syntax is {} ?
<asterite> Yes, {1, 2, 3}
<asterite> wanderer_: what was the issue with generate_docs on windows?
<wanderer_> try it yourself
<wanderer_> uncomment the line and compile the compiler
<wanderer_> I suppose there's some macro magic involved which I don't understand because I haven't taken a look at them and macros in general
<wanderer_> `Crystal.generate_docs result.program, included_dirs`
<wanderer_> command.cr
<asterite> Ah, ok
<asterite> Umm... it's uncommented
<wanderer_> yes, so that it works
<wanderer_> err
<wanderer_> yes, you did*
<wanderer_> but try compiling it now
<wanderer_> I actually commented it
<asterite> You mean, cross-compile it unix->windows or cross-compile it windows->windows ?
<wanderer_> cross-compile it with the commands I wrote to readme_win32.md 3.
<wanderer_> btw Slice#[] with Range doesn't seem to exist
<wanderer_> http://pastebin.com/CB6Qtfvs gives me `undefined method 'delete_at' for Slice(String)`
<asterite> I guess it's because of this line: ARGV = ARGVF[1, ARGVF.length - 1]
<asterite> ARGVF is a slice, and #[] gives a slice, but all code expects ARGV to be an Aray
<asterite> array
<wanderer_> sorry?
<wanderer_> the original code is `ARGV = (ARGV_UNSAFE + 1).to_slice(ARGC_UNSAFE - 1).map { |c_str| String.new(c_str) }`
<wanderer_> so that's a slice, too, isn't it?
<asterite> No, Slice#map returns an Array. Maybe it should return a Slice, hmmm...
<asterite> Ah, Slice#map isn't defined, it uses Enumerable's, so it's returning an Array
<wanderer_> asterite: ah, k, why does ARGV need to be an Array, though, isn't it constant?
<wanderer_> `command = ARGV.shift? || "install"`
<asterite> It's mutable
<wanderer_> k thx
<wanderer_> what's with String#[]? ?
jua_ has quit [Ping timeout: 264 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/veYQ6
<crystal-gh> crystal/master fb50e54 Ary Borenszweig: Fixed `with ... yield` scope issues. Fixed #510. Fixed #234
ic5y has joined #crystal-lang
<wanderer_> asterite: http://pastebin.com/4smVwfRa the compiler doesn't complain here, shouldn't this fail, too?
asterite has quit [Ping timeout: 246 seconds]
<travis-ci> manastech/crystal#2181 (master - fb50e54 : Ary Borenszweig): The build passed.
bcardiff has joined #crystal-lang
wanderer_ has quit [Ping timeout: 246 seconds]
<ic5y> can I get void pointer the same way as getting a pointer to an int? Pointer(Void)?
<jhass> yup
<ic5y> thanks :)
<ic5y> is there any idea to make Pointer(T).malloc(1) a little bit prettier?
<ic5y> other than malloc_one
bcardiff has quit [Quit: Leaving.]
<jhass> I think it's okay :)
<jhass> what would be your idea?
<ic5y> dont know, isnt is a bit unreadable? :P
<jhass> don't think so
<ic5y> for malloc_one, I just have to give a struct to it? Like Pointer.malloc_one(CustomStruct) ?
weskinner_work has quit [Quit: weskinner_work]
<jhass> an instance of it from the looks of it
<ic5y> oh, i read the API which links to an older version of the source that does not have comments
<jhass> so I guess it copies the stack allocated value into the heap
<jhass> I'm not good with that stuff :)
<ic5y> yea it does exactly that
ic5y has quit [Quit: Page closed]
sillesta has quit [Ping timeout: 246 seconds]