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
ismaelga has joined #crystal-lang
<travis-ci> manastech/crystal#2263 (master - 4bd4b07 : Ary Borenszweig): The build passed.
ponga has joined #crystal-lang
ponga has quit [Quit: Leaving...]
ponga has joined #crystal-lang
waterlink1 has joined #crystal-lang
waterlink has quit [Ping timeout: 264 seconds]
Kache4 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
shama has quit [Remote host closed the connection]
waterlink1 has quit [Ping timeout: 250 seconds]
DerisiveLogic has joined #crystal-lang
DerisiveLogic has quit [Read error: Connection reset by peer]
DerisiveLogic has joined #crystal-lang
ponga has quit [Remote host closed the connection]
ponga has joined #crystal-lang
DerisiveLogic has quit [Ping timeout: 240 seconds]
shama has joined #crystal-lang
JBat has joined #crystal-lang
ismaelga has quit [Read error: Connection reset by peer]
vikaton has quit [Quit: Connection closed for inactivity]
JBat has quit [Ping timeout: 245 seconds]
JBat has joined #crystal-lang
bcardiff has joined #crystal-lang
ponga has quit [Remote host closed the connection]
BlaXpirit has joined #crystal-lang
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
HakanD__ has joined #crystal-lang
Kache4 has joined #crystal-lang
strcmp1 has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
ponga has joined #crystal-lang
HakanD__ is now known as HakanD
HakanD_ has joined #crystal-lang
HakanD has quit [Ping timeout: 244 seconds]
Kache4 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
ponga has quit [Quit: Leaving...]
ponga has joined #crystal-lang
Ven has joined #crystal-lang
BlaXpirit has quit [Quit: Quit Konversation]
JBat has quit [Quit: Computer has gone to sleep.]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
havenwood has quit [Remote host closed the connection]
HakanD_ is now known as HakanD
JBat has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
HakanD_ has joined #crystal-lang
HakanD has quit [Ping timeout: 264 seconds]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leafybasil has joined #crystal-lang
HakanD__ has joined #crystal-lang
HakanD_ has quit [Ping timeout: 265 seconds]
Ven has joined #crystal-lang
Ven has quit [Read error: No route to host]
strcmp2 has joined #crystal-lang
strcmp2 has quit [Remote host closed the connection]
strcmp1 has quit [Ping timeout: 244 seconds]
strcmp1 has joined #crystal-lang
vikaton has joined #crystal-lang
BlaXpirit has joined #crystal-lang
DerisiveLogic has joined #crystal-lang
Dreamer3 has joined #crystal-lang
Regexident has joined #crystal-lang
ismaelga has joined #crystal-lang
<Dreamer3> any way to call a private method from outside?
<jhass> I think there was one but I don't remember
<jhass> but you simply shouldn't do it
<strcmp1> maybe possible 'with blah yield' ?
<jhass> it's a strong code smell IMO
<jhass> I strongly advocate the use of public_send in Ruby for that reason
<Dreamer3> does zamith come here?
<Dreamer3> jhass: i was just testing :)
<Dreamer3> trying to figure out how to get crystal running on heroku
<Dreamer3> or does that one guy doing it work there and have a special hookup
<jhass> never tried it
<Dreamer3> guess i'm still doing something wong
<jhass> heroku logs might be informative
<Dreamer3> hmmm
<Dreamer3> can't bind to port 80?
<jhass> yeah you can't
<jhass> crystalshards seems to use the default port of 3000
<jhass> ah no, actually it expects to respect the --port argument https://github.com/zamith/heroku-buildpack-crystal/blob/master/bin/release#L7
<Dreamer3> yeah i'm doing --port $PORT
<Dreamer3> i thought that was what i had wrong, but nope
<Dreamer3> still something else
<jhass> respecting ENV["PORT"] could work too I guess
<Dreamer3> i assume that's where $PORT was coming from
<Dreamer3> "You can reference other environment variables populated by Heroku, most usefully the $PORT variable, in the command."
<jhass> you mean $PORT is 80?
<Dreamer3> no i fixed that :)
<Dreamer3> weir
<Dreamer3> it boot up whe run with herok run, but still the web app won't connect
<jhass> and there's nothing in the logs?
<Dreamer3> oh here we go
Regexident has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Dreamer3> 2015-04-28T13:59:11.210122+00:00 heroku[run.1869]: Process exited with status 130
<jhass> uh
<Dreamer3> n/m that was from my run
<Dreamer3> duh :)
<Dreamer3> nope
<Dreamer3> release, deploy, nothing
<jhass> tail the log and try a heroku restart
Ven has joined #crystal-lang
<Dreamer3> i have the full log
<Dreamer3> there is just nothing there
<Dreamer3> push looks normal, i can paste tha tin one sec
<Dreamer3> pushing again
<jhass> add some debug output to your app, like "Starting on #{port}...", "Received request", "Left main loop" etc
<Dreamer3> it does show "starting"... should that be in the heroku log?
<jhass> if it goes to stdout, yes iirc
<jhass> you're trying to deploy crystalshards?
<Dreamer3> yep
drizz has quit [Ping timeout: 240 seconds]
<Dreamer3> doesn't seem do
<Dreamer3> i added a puts right after the requires
<Dreamer3> and of course frank has it's own thing if it got that far
drizz has joined #crystal-lang
<Dreamer3> heroku ps shows nothing
<Dreamer3> which can't be good
HakanD__ has quit [Quit: Be back later ...]
<Dreamer3> uh do i have to manually start it
<Dreamer3> that seems strange
<Dreamer3> heroku ps:scale web=1 worked
<Dreamer3> doing another deploy
<Dreamer3> ok maybe it just doesn't work till you scale once
<Dreamer3> seems picking one default web worked would ahve been a no brainer though
<Dreamer3> since i have a procfile tha tonly lists one process
<jhass> did heroku create ...; git clone; cd; heroku buildpack:set; git remote add; git fetch; git reset; git push
havenwood has joined #crystal-lang
<strcmp1> jhass, yeah, i agree it's a code smell, and +1 to public_send too.
<strcmp1> even in ruby i have only used it if i was doing something hacky or quick and dirty in a repl.
harisamin has joined #crystal-lang
HakanD__ has joined #crystal-lang
ponga has quit [Remote host closed the connection]
<Dreamer3> jhass: weird i had to kick mine with the ps:scale
<Dreamer3> now it seems solid
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
strcmp1 has quit [Quit: Leaving]
strcmp1 has joined #crystal-lang
strcmp1 has quit [Quit: Leaving]
strcmp1 has joined #crystal-lang
zipR4ND has joined #crystal-lang
orliesaurus has quit [Quit: ZNC - http://znc.in]
<BlaXpirit> it would be nice to run a folder like you can require a folder
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/vfxzp
<crystal-gh> crystal/master 9887c99 Ary Borenszweig: Optimized BufferedIO#gets
<crystal-gh> crystal/master 65336de Ary Borenszweig: Fixed #585: if `crystal run/spec` fails, exit with code 1
<crystal-gh> crystal/master 2051494 Ary Borenszweig: Fixed #584: give correct error instead of crash for wrong static array restriction. Also cleaned up some code.
Regexident has joined #crystal-lang
Regexident has quit [Remote host closed the connection]
HakanD___ has joined #crystal-lang
HakanD__ has quit [Ping timeout: 256 seconds]
havenn has joined #crystal-lang
havenwood has quit [Ping timeout: 264 seconds]
<travis-ci> manastech/crystal#2264 (master - 4d7731a : Ary Borenszweig): The build passed.
Regexident has joined #crystal-lang
zipR4ND has quit [Ping timeout: 256 seconds]
<fowl> what do i need to do get this working on windows
<BlaXpirit> fowl, you need to make it work on windows :|
<fowl> BlaXpirit, where to start, cross compiling?
<BlaXpirit> there is no support for Windows, and I haven't heard of any success with it
<BlaXpirit> I know very little anyway
<jhass> fowl: there's some early work in https://github.com/manastech/crystal/tree/windows based on Crystal 0.6.1
<fowl> cool thanks
havenn is now known as havenwood
ismaelga has quit [Remote host closed the connection]
leafybasil has quit [Remote host closed the connection]
jua_ has joined #crystal-lang
Regexident has quit [Ping timeout: 264 seconds]
harisamin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<BlaXpirit> this .not_nil! stuff is getting on my nerve
<BlaXpirit> why is it "!" anyway?
<jhass> because it may raise
<jhass> I guess
<BlaXpirit> and i thought ! means mutating
<jhass> yeah, I guess they cargo culted it from Rails where things like .save on a model return true/false and .save! raises
<BlaXpirit> :|
<jhass> I'd like distinct signals for raises/modifies self and returns bool/may return nil too
<jhass> but it's hard to find new symbols I guess
<strcmp1> in ruby it doesn't strictly mean mutate either, just that it's "dangerous"
<jhass> in core ruby it means that strictly
<strcmp1> not according to matz
<jhass> but in practice
<jhass> in rails it means "the variant that raises"
<jhass> many rails people use it as "dangerous" in their application code
<BlaXpirit> screw that
<strcmp1> idk, it seems like a silly thing to argue but according to matz definition the ! is for methods that are "dangerous", so i usually use it along those lines which probably be closer to how rails uses it as well
<strcmp1> but then again, a lot of non-bang methods i write can raise as well
<strcmp1> the one use case that stands out is using something called shrink! to downsize a process pool forcefully(through SIGKILL), and that fitted along the lines of 'dangerous' as well, so i implemented that once.
<jhass> oO SIGKILL before trying SIGTERM is very bad practice
<jhass> and yeah, I know many rubyists use it that way
<jhass> but I like clear rules when to apply it better
<jhass> and in practice ruby core is "if there's a bang method, there exists a non-bang method that returns a modified copy"
<strcmp1> well, there is a "shrink" variant that used SIGUSR1 to do a graceful shutdown.
<jhass> and in practice the Rails API is "if there's a bang method that raises and there's a non-bang method that returns true/false"
<strcmp1> yeah, is there other cases than save! though?
<jhass> so I try follow these rules depending on the project I'm in
leafybasil has joined #crystal-lang
HakanD___ has quit [Quit: Be back later ...]
harisamin has joined #crystal-lang
JBat has quit [Ping timeout: 264 seconds]
shama has joined #crystal-lang
wanderer_ has joined #crystal-lang
HakanD___ has joined #crystal-lang
HakanD___ has quit [Quit: Be back later ...]
<wanderer_> jhass: hey, when you use dup2, don't you normally close the handle you copied?
<wanderer_> I'm trying to understand pipes and dup atm
<jhass> no idea
<jhass> oh, hm
<jhass> huh, why?
<jhass> mh, the reopen API seems to be the wrong way around if I look at it again though
bcardiff has joined #crystal-lang
<jhass> it should be STDOUT.reopen(null), semantically
<wanderer_> null.reopen(STDOUT); null.close, so it's like a `STDOUT = null`
barosl has joined #crystal-lang
ismaelga has joined #crystal-lang
<wanderer_> STDOUT.reopen(null) would make more sense, reopen should then call `LibC.dup2(other.fd, self.fd)` instead of `LibC.dup2(self.fd, other.fd)`
<jhass> yeah
<jhass> and I think it's in ruby that way
<wanderer_> afaik this sets STDOUT to null by duplicating the handle, so null needs to get closed
<jhass> Reassociates ios with the I/O stream given in other_IO or to a new stream opened on path. This may dynamically change the actual class of this stream.
<jhass> that's ruby's docs
<jhass> "If fildes2 is already a valid open file descriptor, it shall be closed first" are you referring to this?
<wanderer_> where does it come from?
<jhass> the posix uses some more difficult language there, they describe what the function should do (and thus indeed does), not what the caller should do
<jhass> man dup2
<wanderer_> I've read that dup duplicates the handle, so two handles = two close I'd say
<jhass> The dup2() function shall cause the file descriptor fildes2 to refer to the same open file description as the file descriptor fildes and to share any locks,
<jhass> and shall return fildes2
<jhass> it's not really a copy
<jhass> more like a hardlink, two pointers to the same resource
<jhass> after all a filedescriptor is just a number
ismaelga has quit [Remote host closed the connection]
<jhass> and that function changes what that number is associated with
<wanderer_> hm
<wanderer_> check example 2
<wanderer_> "// Close original write end of pipe" and "Then, use _dup or _dup2 to create an inheritable copy of the pipe descriptor that you want to pass to the child. "
<wanderer_> so maybe it's different on windows
<jhass> I'm not sure
<jhass> but this case is not a pipe anyway
<wanderer_> has a following close as well
HakanD___ has joined #crystal-lang
<jhass> mh, maybe, that stuff always confuses me
<jhass> anyway, we definitely should swap around the API
<jhass> it's confusing that way around
<wanderer_> def reopen(other); if LibC.dup2(other.fd, self.fd) == -1; raise Errno.new("Could not reopen file descriptor"); end; self; end
<jhass> yeah
<jhass> I'm currently trying to think of something where it would break because other.fd is of another class
<jhass> er, other is of another class than self
<jhass> but I think it's the saner API and we can deal with that if we actually run into it
bcardiff has quit [Quit: Leaving.]
harisamin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<wanderer_> jhass: does a spawned child process get the parent's input and output handles? in the msdn example 2, a pipe is created and the parent's stdout is redirected, then the child process is created and the parent's stdout is restored, so there's no explicit `child.stdout = xyz` which is why I assume that the child gets the parent's stdout
<jhass> fork copies a processes memory and FD
<jhass> s
<wanderer_> example 2 doesn't use fork, though, as there is no such thing on windows :P
<wanderer_> I'll have to test it to get a precise answer
ponga has joined #crystal-lang
<jhass> so if you do nothing the child process has the same stdout, stdin and stderr
<wanderer_> I find the msdn docs kinda lacking on that part
<jhass> if you want to communicate with the child process a common approach is to create a pipe (or two if you want it bidirectional), and close the end you don't need after the fork
<jhass> so you can't clone a process in windows?
<wanderer_> nope
<jhass> how do you spawn a child process?
<wanderer_> CreateProcess
<wanderer_> or wrappers around it, like spawnv
BlaXpirit has quit [Read error: Connection reset by peer]
BlaXpirit has joined #crystal-lang
waterlink has joined #crystal-lang
ismaelga has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
ismaelga has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
ismaelga has joined #crystal-lang
HakanD___ has quit [Quit: Be back later ...]
<wanderer_> jhass: why does Process.waitpid right-shift the exit_code by 8 bits?
<crystal-gh> [crystal] jhass opened pull request #588: Raise JSON::ParseException in json_mapping (master...json_mapping_exception) http://git.io/vfh7k
<jhass> If status is not NULL, wait() and waitpid() store status information in the int to which it points. This integer can be inspected with the following macros
<jhass> returns the exit status of the child. This consists of the least significant 8 bits of the status argument that the child specified
<wanderer_> ah
<wanderer_> wait, least significant 8 bits, wouldn't that mean `status & 0xff`?
<jhass> let me dig out the source of the macro
<jhass> #define __WEXITSTATUS(status) (((status) & 0xff00) >> 8)
<jhass> # define WEXITSTATUS(status) __WEXITSTATUS (__WAIT_INT (status))
<jhass> __WAIT_INT doesn't do anything relevant
<wanderer_> so the code is correct, but the docs aren't or at least misleadingly worded
<jhass> I guess
ponga has quit [Remote host closed the connection]
BlaXpirit has quit [Quit: Quit Konversation]
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vfjvi
<crystal-gh> crystal/master 5fed3f0 Jonne Haß: Raise JSON::ParseException in json_mapping...
<crystal-gh> crystal/master b3f6d6a Ary Borenszweig: Merge pull request #588 from jhass/json_mapping_exception...
<wanderer_> jhass: as for bidirectional pipes, on windows there is also no select, so again I'm unsure how to port Process.run to windows
<jhass> oO
<jhass> no select?
<jhass> that's harsh
<wanderer_> well, there must be some equivalent
<jhass> ?
<jhass> it talks about sockets, mh
<wanderer_> that's only for sockets
<fowl> you need IOCP
<wanderer_> fowl: thx, I already found the same link but haven't read through it yet
<wanderer_> libevent uses IOCP as well
<wanderer_> fowl: are you familiar with that? it probably needs refactoring the whole code
<fowl> i'm trying to build the windows branch but getting error for File::PATH_SEPARATOR undefined, do i need to set a variable so it finds this std lib
<jhass> most likely, check bin/crystal
<wanderer_> path = Dir.working_directory + "#{File::SEPARATOR}src" if path.length == 0
<wanderer_> what is your working directory?
ponga has joined #crystal-lang
<fowl> ~/src/crystal-win
<wanderer_> you're building it on linux?
<fowl> yea
ponga has quit [Remote host closed the connection]
<wanderer_> are you using the shellscript bin/crystal?
<fowl> no because there is no built crystal so its trying to use the crystal on $PATH
<wanderer_> bin/crystal sets stuff like `ENV["CRYSTAL_PATH"]`
<fowl> ah ok
<wanderer_> I'm atm applying the windows changes to crystal HEAD
ismaelga has quit [Remote host closed the connection]
<fowl> CRYSTAL_PATH="$(pwd)/src:libs" ~/src/crystal/.build/crystal build src/compiler/crystal.cr -- looks like LLVM library is out of sync or something
<fowl> ah ok
<wanderer_> you'd also need a bunch of libs for linking
<fowl> you could share yours possibly? :]
<wanderer_> yes, I gave them asterite, but he didn't upload them to github
<wanderer_> I can upload them for you to some one click hoster
<wanderer_> you also need mingw-w64
jua_ has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<travis-ci> manastech/crystal#2266 (master - b3f6d6a : Ary Borenszweig): The build was broken.
<fowl> cool thank you
ponga has joined #crystal-lang
ismaelga has joined #crystal-lang
<wanderer_> fowl: do you know why writing to the new process via a pipe doesn't work here: http://pastebin.com/T2Xe5KUa ? I'm starting a cmd.exe and want to write "exit" to the pipe that's connected to the child's stdin
<wanderer_> `Process.run("cmd.exe", input: "exit", output: true)`
<wanderer_> the pipe `read_from_child` is working and I get the cmd's output, write_to_child, however, is not
ponga has quit [Remote host closed the connection]
<wanderer_> oh.. yeah, \n missing
ponga has joined #crystal-lang
<wanderer_> doesn't really work, though..
wanderer_ has quit [Quit: Page closed]
<Dreamer3> is there no way to say: {} of String => _
<Dreamer3> and let the compiler figure out the value types at compile time?
<Dreamer3> and let the compiler figure out the value types at compile time?
<Dreamer3> and let the compiler figure out the value types at compile time?
<Dreamer3> grrr
waterlink has quit [Ping timeout: 244 seconds]
<vikaton> Dreamer3: only one way to find out
<vikaton> >> x = {} of String => _
<DeBot> vikaton: Error in line 3: can't use underscore as generic type argument
<Dreamer3> yeah i saw that
<vikaton> >> x = {} of String => String
<DeBot> vikaton: {}
willlll has joined #crystal-lang
<Dreamer3> i wonder if i'm doing something wrong though
<vikaton> next release of crystal needs to come out already
<Dreamer3> yep
<jhass> if that would be possible the whole of x construct wouldn't exist ;)
<willlll> hey, I've been learning crystal by writing a postgres driver, and the C linking has been really easy. Great job with that
strcmp1 has quit [Quit: Leaving]
HakanD___ has joined #crystal-lang
HakanD___ has quit [Ping timeout: 255 seconds]