ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
happycoder has joined #crystal-lang
codenoid has joined #crystal-lang
DTZUZU has quit [Quit: WeeChat 1.9]
happycoder has quit [Ping timeout: 248 seconds]
DTZUZU has joined #crystal-lang
happycoder has joined #crystal-lang
happycoder has quit [Ping timeout: 268 seconds]
<FromGitter> <faustinoaq> http://myst-lang.org/
<FromGitter> <faustinoaq> Interesting, almost two languages made using crystal, very impressive 👍
happycoder has joined #crystal-lang
<woodruffw> sorry if this is a stupid question: does anybody know why `String.starts_with?(char : Char)` is implemented the way it is?
<woodruffw> i was looking at it and wondering why it isn't just `return self[0] == char`
<woodruffw> (for reference: https://git.io/vbHM7)
happycoder2 has joined #crystal-lang
happycoder has quit [Ping timeout: 240 seconds]
<FromGitter> <marksiemers> `self[0]` would probably break on an empty string
<FromGitter> <marksiemers> If you look at `ends_with?` there is all kinds of `to_unsafe` going on, and checking bytesize. ⏎ It could be that the `each_char` avoids that, but it does look very strange.
<woodruffw> ah, yeah, `self[0]` breaks with `""`. adding `return false if empty?` covers that, though...
<FromGitter> <marksiemers> Yeah, I think `each_char` takes care of a lot of the different memory sizes (ascii vs non-ascii): ⏎ https://github.com/crystal-lang/crystal/blob/e2a1389e8165fb097c785524337d7bb7b550a086/src/string.cr#L3590
<FromGitter> <marksiemers> It has an early return - so in a non-empty string, that block only gets executed once
<FromGitter> <marksiemers> and if it is empty, the the default `false` return is at the bottom.
<FromGitter> <marksiemers> It would be helpful for readability if there were `first_char` and `last_char` methods, even if private.
<FromGitter> <marksiemers> The `last_char` one might be tricky to implement without O(n)
<woodruffw> i see, thanks
<FromGitter> <marksiemers> Releasing the newest version of crystal in time for shards to update before new year's would be great.
<FromGitter> <marksiemers> I'm fairly certain the amber team will work toward that between christmas and new year's if the 0.24.1 is release with a few days to spare
happycoder2 has quit [Ping timeout: 248 seconds]
ylluminate has quit [Ping timeout: 248 seconds]
ashirase has quit [Ping timeout: 240 seconds]
ashirase has joined #crystal-lang
happycoder has joined #crystal-lang
happycoder has quit [Ping timeout: 248 seconds]
happycoder has joined #crystal-lang
happycoder has quit [Ping timeout: 272 seconds]
ashirase has quit [Ping timeout: 264 seconds]
ashirase has joined #crystal-lang
<crystal-gh> [crystal] woodruffw opened pull request #5442: INI: Rewrite parser to avoid regular expressions (master...ini-parser-without-re) https://git.io/vbHSj
sz0 has joined #crystal-lang
codenoid has quit [Remote host closed the connection]
happycoder has joined #crystal-lang
happycoder has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
happycoder has joined #crystal-lang
happycoder has quit [Ping timeout: 248 seconds]
happycoder has joined #crystal-lang
alex`` has quit [Ping timeout: 272 seconds]
happycoder has quit [Ping timeout: 248 seconds]
rohitpaulk has quit [Ping timeout: 265 seconds]
alex`` has joined #crystal-lang
alex`` has quit [Client Quit]
happycoder has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
rohitpaulk has joined #crystal-lang
happycoder has quit [Ping timeout: 264 seconds]
alex`` has joined #crystal-lang
happycoder has joined #crystal-lang
happycoder has quit [Read error: Connection reset by peer]
happycoder has joined #crystal-lang
happycoder has quit [Read error: Connection reset by peer]
happycoder2 has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.0]
happycoder has joined #crystal-lang
happycoder2 has quit [Ping timeout: 260 seconds]
alex`` has joined #crystal-lang
<oprypin> marksiemers, funnily enough, last_char is easily O(1) but there's no implementation of it
sz0 has joined #crystal-lang
<oprypin> e.g. string[-1] will scan from the very start of the string when really all it could do is start from the back and find the first byte < 128 and go from there
<oprypin> woodruffw, howd you create the git,io link?
<oprypin> but indeed ends_with is very optimal, even beyond what a `last_char` could provide
happycoder2 has joined #crystal-lang
happycoder has quit [Ping timeout: 248 seconds]
p0p0pr37 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
happycoder2 has quit [Ping timeout: 248 seconds]
afraeim has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
<afraeim> hi brothers
happycoder has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
happycoder has quit [Ping timeout: 252 seconds]
afraeim has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
<FromGitter> <bew> Hi
<RX14> oprypin: its even worse than that because I'm certain we have the ability to read utf8 backwards
<oprypin> not sure what you mean by "its even worse"
<RX14> As in utf8 is designed so you can look at any byte and find the character its part of
<RX14> And we have code to do that
<RX14> We just don't use it
<RX14> So it's even worse in that its so easy to optimize
<oprypin> i describe how it's easy to optimize then you say "it's even worse in that its so easy to optimize"
<oprypin> mkay
<RX14> No its even worse in that its easier to optimize than you think because the code is already written
<RX14> And also that you don't need to go back to the last ascii char because utf8 is a far more useful encoding than that
happycoder has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
happycoder has quit [Ping timeout: 248 seconds]
<Yxhuvud> Yeah, you need at the most 4 byte, right?
bmcginty has quit [Ping timeout: 256 seconds]
hightower3 has joined #crystal-lang
happycoder has joined #crystal-lang
hightower2 has quit [Ping timeout: 248 seconds]
happycoder has quit [Ping timeout: 252 seconds]
<RX14> Yxhuvud, it's simple: if the byte starts with 10 then it's a multibyte sequence
<RX14> you just count back in bytes until you stop seeing 10
<FromGitter> <Jens0512> Why does this: ``` ⏎ @@file = File.new "/private/etc/to/where.json", "w" ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a3e454b5355812e570cf5f8]
<RX14> and then you look at the top bits and from that ypu can count the length of the sequence
<oprypin> probably "/private/etc/to/" doesnt exist
<FromGitter> <Jens0512> So i have to create the directory first?
<oprypin> @Jens0512, the edits you just made are fine but keep in mind that IRC users don't see edits so don't do anything substantial
<FromGitter> <Jens0512> OK
<oprypin> Jens0512, definitely. it's the same across all languages
<RX14> you can use File.dirname to get just the directory portion of the path
<FromGitter> <Jens0512> Oh, ok, haven't worked to much with files, and when i did it was on the classpath
<RX14> then use File.mkdir to create it
<FromGitter> <Jens0512> Ok, thank you very much
<RX14> oops
<RX14> Dir.mkdir
<FromGitter> <Jens0512> ^^
<RX14> so Dir.mkdir(File.basename(path))
<RX14> then you shoukd be able to File.open(path, "w")
<oprypin> the poorly named mkdir_p seems more fitting
<RX14> yeah
<RX14> its all bad
<RX14> too many things to refactor
<RX14> too little time
<oprypin> mm aliases too https://crystal-lang.org/api/0.23.1/FileUtils.html#mkdir_p%28path%3AString%2Cmode%3D511%29%3ANil-instance-method
<FromGitter> <Jens0512> Got it, but does the `File.open` work if the file doesn't exist?
<RX14> yes
<oprypin> Jens0512, "w" is create or truncate and open
<oprypin> "r" won't work tho
<RX14> "w" will create an empty file if it doesn't exist
<FromGitter> <Jens0512> Ok, thanks, so no difference between File.new and File.open is just the same?
<RX14> if it does exist it will delete the contents of the old one
<RX14> if you want to open it for appending, use "a"
<FromGitter> <Jens0512> Ok, thanks
<oprypin> @Jens0512, iirc File.new doesnt stand for "new file" but for "initialize a file object"
<RX14> look at `man fopen` for the details on the modes
<oprypin> ah, file.open is an alias to file.new. great..
<RX14> yeah oprypin
<RX14> i look at the File/Dir classes and every time i'm disappointed
<oprypin> needs more pathlib
<RX14> hmm?
<FromGitter> <Jens0512> Eh, wrong language XD
<oprypin> of course, if i were to implement it, it would get rejected cuz ruby doesn't do it
<oprypin> so whatever
<RX14> nope lol oprypin
<RX14> i would support someting like pathlib
<oprypin> well you're sane
<RX14> well, as it happens, so are most of the core team
<RX14> i'd remove the platform-specific subclases though oprypin
<RX14> and probably merge purepath and path
<RX14> i've used java's nio path which has a similar OO Path design
<oprypin> why tho, it's the best part
<RX14> and I really ejoyed it
<RX14> oprypin, why?
<oprypin> well you can manipulate abstract posix paths on Windows
<oprypin> an opaque implementation wouldn't allow that
<RX14> yeah I just read that
<oprypin> oh you're talking about pure which is not quite the sae
<RX14> I think prhaps PurePath/Path split
<RX14> with PurePath able to have a mode
<RX14> which changes the unix/windows handling mode
<RX14> i'd rather not have 6 classes
<RX14> it's too bloated for ruby
<RX14> crystal*
<RX14> ...
<oprypin> lol
<oprypin> https://docs.python.org/3/library/pathlib.html has the classes depicted btw
<RX14> yes thats the doc I was looking at
<RX14> its better
<FromGitter> <Jens0512> Uh, may i ask how to deal with this?: `Unable to create directory '/private/etc/to': Permission denied` 😅 If not i can probably find out somehow
<FromGitter> <Jens0512> Should i change to a process?
<oprypin> Jens0512, can you go to a shell and run `mkdir /private/etc/to`
<RX14> @Jens0512 looks like a permissions error to me
<oprypin> you probably actually don't have permissions, cuz why would you?
<FromGitter> <Jens0512> Wouldn't a shell throw the same permission error?
<RX14> Path.relative_to is so useful
<RX14> @Jens0512 yes
<oprypin> that's the point
<FromGitter> <Jens0512> Would something like `sudo mkdir -p /private/etc/to`work?
<FromGitter> <Jens0512> (This is a cli I'm making)
<oprypin> probably but you also probably should stop and think what you're doing, and describe the actual problem you're trying to solve
<RX14> you probably want to chmod or chown the path
<FromGitter> <Jens0512> Im just trying to create a file at `/private/etc/to/where.json`for now
<oprypin> why tho
<FromGitter> <Jens0512> Thanks for the help, i'll figure out the rest for myself ^^
<RX14> how is ruby's documentation literally the most confusing and hard to navigate thing ever
<RX14> it's like they tried to make it bad
<RX14> and succeeded
<RX14> then we just nuke File and Dir when they aren't looking
<oprypin> i would be more interested in directly copying pathlib than this dues to the naming and general design
<RX14> yeah oprypin
<RX14> we don't have to directly copy one or the other oprypin
<oprypin> then i'd need to think :(
<RX14> lol
<oprypin> the nice thing is that Crystal can afford to stick to the normal String type to store paths
<Papierkorb> mh?
<oprypin> Windows only allows Unicode, and Linux... well... we'll just store an invalid string, what could go wrong
<Yxhuvud> And then there are the case sensitive variants :D
<Papierkorb> case insensitivity + unicode. *clap clap*. Good job windows and mac.
<oprypin> it's not so bad though. the real bad thing is arbitrary bytes in file names
<Papierkorb> Never has been an issue for me, as has not case-sensitivity
<oprypin> not for you personally but for a general-purpose standard library it is
<oprypin> imagine supporting String|Bytes whenever a path is expected
<oprypin> and u get Python :|
<oprypin> then add Path to the mix and u get Python 3.4
<Papierkorb> Using String for paths is a hassle in any case, I hate passing a string around to denote a path
<oprypin> regardless of what you do, think of the underlying representation that some code needs to deal with at some point
A124 has quit [Read error: No route to host]
A124 has joined #crystal-lang
bmcginty has joined #crystal-lang
<RX14> the symbols that actually make it into windows's libcmt seem to be entirely arbitrary
<RX14> can't link to snprintf, seems to call vsnprints
<RX14> as in inline function in the headers
<RX14> i don't know how people do it
<oprypin> owie
<RX14> and after I fix then i have to work out why pcre.lib is broken
<RX14> pcre.lib(pcre_compile.obj) : error LNK2019: unresolved external symbol __imp_strncmp referenced in function compile_branch
<oprypin> that brings bad memories
<RX14> not that anything like that symbol exists in libcmt.lib
happycoder has joined #crystal-lang
<RX14> oprypin, at least the "win32" functions seem to be there
<RX14> the c99 ones not so much
<RX14> damnit how the fuck does va_list work anyway
<RX14> go away windows
happycoder has quit [Ping timeout: 248 seconds]
<RX14> printing floats replies on snprintf
<RX14> and you can only do that with va_list
<RX14> and va_list's functions are all not in libc either
<RX14> this makes no sense: if I search for printf in libcmt.lib i get nothing but it links fine
<RX14> if i do the same for snprintf I get nothing but it doesn't link fine
<FromGitter> <drosehn> are `va_list`s different under windows than under unix?
<RX14> they have a different binary representation
<RX14> but crystal supports them neither on windows or linux
<oprypin> how to do abstract class method? https://carc.in/#/r/3a6p
<Papierkorb> Not possible.
<oprypin> what is the alternative?
<oprypin> pimpl module D:
<Papierkorb> Pass it in as value
<oprypin> I don't quite understand what you mean
<Papierkorb> sub-classes can easily pass it through to super
<Papierkorb> Or just use a abstract method in the instance and the implementation implements it returning a (constant) value
<oprypin> no :|
<RX14> i wish someone was paying me to put up with windows's shit
<oprypin> RX14, but you have to do it for free because manas takes all the money?
<RX14> ...i wouldn't put it like that
<Vexatos> I can pay you in gloating
<oprypin> i get that this was rhetorical but it doesnt have to me
<Papierkorb> I can cheer on you
<oprypin> be
<Papierkorb> Small price to pay for the entertainment
<RX14> you can do that in another channel Vexatos
<RX14> and i'm doing it all on a 13" laptop
<Papierkorb> DO IT RX, we believe in you! Weeeeee
<RX14> which makes it worse
<oprypin> why tho
<Papierkorb> No spare screen around?
<Vexatos> a 13'' laptop with two connected monitors.
<RX14> no Vexatos
<oprypin> why tho
<RX14> funilly enough 2 24" monitors doesn't fit on the train
<Vexatos> odd
<RX14> oprypin, i'm with my parents over christmas
<Papierkorb> Your family doesn't have an old screen lying around?
<Papierkorb> Simply go in-house scavenging
<oprypin> or a TV lol
<RX14> don't have a hdmi to vga adapter
<Vexatos> I can ship one to you - it'll certainly arrive once you are back to your own monitors
<RX14> thanks for the help
<oprypin> anyhow...
<RX14> i should have bought some adapters
<oprypin> RX14, how do you think Pathlib would mesh with DirHandle?
<RX14> i don't think that PR is going to be merged oprypin
<oprypin> because under its abstractions there is no permanent storage for a directory handle
<oprypin> RX14, but you approved it lol
<RX14> yeah it was an accident
<RX14> I thought I was on @straight-shoota's windows PR
<RX14> in my local windows branch I have a crystal::system with a single method which returns an Iterator(String) struct
<RX14> which iterates the directory entries
<RX14> and a current and current= method
<RX14> for cwd
<oprypin> so no dirhandle planned even on windows? thats nice
<oprypin> i'm also having some trouble retrofitting Crystal::System into this
<RX14> into which>
<oprypin> pathlib
<oprypin> perhaps the current File module would just move into Crystal::System and done
<RX14> well File is already abstracted, no?
<oprypin> well... most of its class methods, anyway
<oprypin> file should be just to access files, not for abstract file system stuff
<RX14> yeah
<oprypin> no class methods, basicall
<oprypin> which is what I mean to be moved
<RX14> you can split the class methods into some path.cr in system
<RX14> and do it that way
<RX14> idk
<RX14> use your creativity
<RX14> on both platforms the Crystal::System interface should end up being class methods
<RX14> which take/return strings
<RX14> and perform actions or retrieve info
<oprypin> methods on a module, not class, perhaps?
<oprypin> i like it. best part is, i'll be copying pathlib even more exactly than initially expected
<RX14> yes
<RX14> module, class whatever
<RX14> how so oprypin ?
<oprypin> well pathlib has no system-specific real file operations
<oprypin> only pureposixpath and purewindowspath have different implementation
<RX14> I think there should only be one Path honestly
<oprypin> yeah that's fine
ruby_ has joined #crystal-lang
<oprypin> abstract class Path::Pure class Path::Posix < Path::Pure class Path::Windows < Path::Pure {% if flag?(:win32) %}class Path < Path::Windows
<FromGitter> <ArtLinkov> can anyone tell me why im getting nil here? (I wanna sum each value with same index of all the arrays in an array) ⏎ https://play.crystal-lang.org/#/r/3a7c
<oprypin> ArtLinkov, each has no return value
<RX14> oprypin, too many classes
<oprypin> RX14, that's the bare minimum
<FromGitter> <ArtLinkov> ah... obliged :)
<RX14> no it's not
<RX14> one is the minimum
<oprypin> Pure needs to store data on it so it's a class
<RX14> why do we need a pure?
<oprypin> you do want to manipulate Posix paths on Windows, without stupid hacks
<RX14> yes
<RX14> make it a ivar
<RX14> which changes a few method's implementations
<RX14> @windows : Bool
<RX14> removed half the classes
<oprypin> that's bad
<RX14> and just remove the pure split
<oprypin> not extensible
<RX14> look at java's implementation then
<oprypin> in fact, having just Path is bad for the same reason
<RX14> they have a filesystem class
ruby_ is now known as rubyanderson
<RX14> which gets delegated all of the platform specifics
<rubyanderson> is possible to change current POSIX with windows env variabele ?
<oprypin> rubyanderson, sorry what?
<rubyanderson> i want make current POSIX data which currently not defined in win32api, with current posix subsystem
<FromGitter> <straight-shoota> @oprypin is there any difference between posix and windows path besides how they handle separators and absolute paths?
<oprypin> \\ c:\
<oprypin> case sens
<rubyanderson> yes, i want to porting POSIX env to Win32 API, which is currently not available on crystal:master
<rubyanderson> i got little trouble in win32 api, as your know, windows API always different
<FromGitter> <straight-shoota> okay, but this could be well flagged with an ivar
<oprypin> RX14, i'm also wondering what people would say about creating a class for every file/path operation
<oprypin> creating an object rather
<FromGitter> <straight-shoota> there are no substantial differences in the API or something
<oprypin> only to throw it away immediately
<rubyanderson> no, it's bad @oprypin
<rubyanderson> it could be IMIX Gargabe Compiler
<Papierkorb> Windows has supported forward slash for over a decade at this point
<rubyanderson> are you sure windows will available in 2018
<oprypin> Papierkorb, it has extremely many corner cases
<FromGitter> <straight-shoota> no object, struct should do
<RX14> oprypin, yeah path can be a struct
<RX14> so its fine
<RX14> its immutable anyway
<rubyanderson> struct has nothing to do with Gargabe Collector,
<Papierkorb> I'd actually prefer writing `Path("foo").copy(to: "bar")` over `File.cp("foo, "bar")`
<oprypin> except it's Path.new ...
<Papierkorb> small detail.
<FromGitter> <straight-shoota> `Path{"foo"}` should work
<oprypin> funnily enough, in Python pathlib doesn't do that
<oprypin> has no copy method
<rubyanderson> currentlu i work in small project
<rubyanderson> writing GO interpreter in crystal
<Papierkorb> straight-shoota, good point. aliasing Path.[] would also be fine to mirror Dir[]
<oprypin> python instead has a module like https://crystal-lang.org/api/0.23.1/FileUtils.html
<Papierkorb> Python isn't really OOP centric
<RX14> >has 575843758934 classes for Paths
<RX14> >not OOP
<RX14> ok
<Papierkorb> ?
<rubyanderson> \n
<rubyanderson> there is only two way to do win64_86 ABI Porting
<rubyanderson> currently miscrosoft use that in windows 10 linux sub system
rubyanderson has left #crystal-lang ["Leaving"]
yamate has joined #crystal-lang
<FromGitter> <jwaldrip> Morning Y'all, have we seen the 0.24.1 release yet?
vera_ has joined #crystal-lang
<vera_> should this behave like this? https://play.crystal-lang.org/#/r/3a8s
<Papierkorb> The parser can't know if the user intended to write an integer or really meant a float. JSON only knows of a numeric type
<Papierkorb> union types are ordered by name, so that A | B == B | A, and that order is also the order in which types are tried to be parsed. The Float can parse `2`.
<Papierkorb> If you want to enforce a special, custom rule, you can use a converter to make such a deduction
<vera_> i see, thanks
vera_ has quit [Quit: Page closed]
rohitpaulk has quit [Ping timeout: 248 seconds]
afraeim has joined #crystal-lang
happycoder has joined #crystal-lang
<Papierkorb> Huh, was Dir.[] removed?
<FromGitter> <straight-shoota> https://crystal-lang.org/api/0.23.1/Dir.html#%5B%5D%28%2Apatterns%29%3AArray%28String%29-class-method
<Papierkorb> Nope, still there
<RX14> i'm completely stumped by compiling pcre
afraeim has quit [Remote host closed the connection]
<RX14> pcre links fine until you use too much of it then you get pcre.lib(pcre_compile.obj) : error LNK2019: unresolved external symbol __imp_strncmp referenced in function check_posix_name
<RX14> and somehow none of the existing windows porting effort has hit this
<Yxhuvud> can you reach out to them for help? perhaps one of them have an idea of what it could be?
happycoder has quit [Ping timeout: 260 seconds]
happycoder has joined #crystal-lang
<RX14> i'm literally grepping through every symbol in every library on windows
<Yxhuvud> isn't that just strncmp? I guess you can't tell it to use https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncmp-wcsncmp-mbsncmp-mbsncmp-l ?
yamate has quit [Ping timeout: 252 seconds]
<RX14> cmake sucks
<RX14> I think I found the problem in my pcre build
yamate has joined #crystal-lang
yamate has quit [Quit: Leaving]
happycoder has quit [Ping timeout: 265 seconds]
ashirase has quit [Ping timeout: 256 seconds]
ashirase has joined #crystal-lang
<woodruffw> oprypin: https://git.io/
<oprypin> oh..
<woodruffw> oprypin: the REST API is documented here: https://github.com/blog/985-git-io-github-url-shortener
<crystal-gh> [crystal] marksiemers opened pull request #5444: Change Hash#key to Hash#key_for (master...fix/change-key-to-key_for) https://git.io/vbQsx
ylluminate has joined #crystal-lang
<Papierkorb> > abstract `def Enumerable(T)#each(&block)` must be implemented by Dir
<Papierkorb> Completely unrelated to the code I wrote (the heck compiler?), but Dir indeed doesn't have a yielding #each
<Papierkorb> Adding one really does fix the compiler error ... which is still unrelated to my code. I do a `Dir[..]` somewhere, but that gives me a Array(String) so .. whatever
<RX14> how on earth does grisu3 break on windows
<RX14> is the ABI broke somehow??
<Yxhuvud> not having a yielded each manages to make the lack of iterator each-es in certain other places look like a small problem.
<Papierkorb> Yxhuvud: It literally breaks my code without me even using an instance of Dir
<Papierkorb> Which is an interesting error by itself
<Papierkorb> Didn't even know that Dir could be instantiated. Never needed it.
<Yxhuvud> that is amazing. are you monkeypatching a module?
<Papierkorb> No
<Yxhuvud> if you implement one that raises, do you get an error when running your code? Perhaps Dir[] make use of the instances?
<Papierkorb> Nope when I implement it it works
<Papierkorb> And I searched my code, I do use Dir[] exactly once, and that returns an array of string
<Papierkorb> I even restrict the return type of that method to array of string
<Papierkorb> It also only appeared in 0.24.x
<Papierkorb> Was fine in 0.23.1
<Yxhuvud> it is implemented in terms of Dir.glob: https://github.com/crystal-lang/crystal/blob/master/src/dir/glob.cr#L28 . I don't feel like digging deeper than that after looking at that thing.
<FromGitter> <drosehn> Could you have your yielding Dir#each print out the stack of callers, to see how the code gets there?
<Papierkorb> It never gets there
<Papierkorb> It's never even called, it can't be, I never even have an instance of Dir ever
<Papierkorb> See the snippet above
<RX14> oh wow I didn't realise that we broke Dir
<RX14> darnit
<oprypin> just add a test :)
<Papierkorb> Actually a Sema to check that a module implements all abstracts
<Papierkorb> a module includer*
ylluminate has quit [Read error: Connection reset by peer]
ylluminate has joined #crystal-lang
yllumina_ has joined #crystal-lang
<FromGitter> <Val> dist.crystal-lang.org down ?
ylluminate has quit [Ping timeout: 240 seconds]
<FromGitter> <jwaldrip> RX14 awesome to see the crystal release on github!
<FromGitter> <jwaldrip> Can we expect a dockerhub release as well?
<RX14> oh TIL
<RX14> uhh
<RX14> i haven't a clue why tests didnt break tough
<FromGitter> <faultyserver> Seconding Val's question. Just had a travis build fail because it couldn't find the `crystal` package.
<FromGitter> <faultyserver> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a3ed0fbe43a7a150c9c93f6]
<Papierkorb> The APT server is 403
<RX14> ...
<RX14> Papierkorb, APT doesn;t work?
<RX14> darnit
<Papierkorb> That's what it says when you GET it
_whitelogger has joined #crystal-lang
<FromGitter> <jwaldrip> Permissions in S3 perhaps?
<Papierkorb> > Qt 5.10.0, linked to 5.10.0 / Crystal 0.24.1
<Papierkorb> Finally
<FromGitter> <jwaldrip> RX14, docker image?
<RX14> wait Papierkorb
<RX14> thats probabblt normal
<RX14> the apt not having a release file is not
<RX14> well
<RX14> nice
<RX14> apt broken, docker old, release has major bugs
<RX14> and everyone's on holiday for christmas
<Papierkorb> Ah well, travis will note once the Dir fix is in, as my still-broken check will "break" :3
A124 has quit [Quit: '']
<FromGitter> <sam0x17> is anyone else working on making Chromium Embedded Framework (CEF) available as a crystal shard? (in other words, Electron for crystal)? Would love to join forces if I'm not the only one
<Papierkorb> Electron *shudder*
<FromGitter> <sam0x17> yeah yeah
<RX14> whyy
<RX14> just use Qt
<RX14> seriously
<FromGitter> <sam0x17> QT isn't free for commercial purposes, and in my experience it's a real pain in the ass
<Papierkorb> Qt isn't free for commercial?
<Papierkorb> It is
<FromGitter> <sam0x17> last I checked that was the case, is that no longer true?
<Papierkorb> As long you don't statically link, sure, but with electron, you have even more files flying around
<Papierkorb> Hasn't been for over a decade
<FromGitter> <sam0x17> ah ok
<FromGitter> <sam0x17> but yeah, would really like a few of the startups I work with to be doing their native desktop apps in crystal rather than in javascript eventually (realistically at least a year from now)
<Papierkorb> The LGPL allows you to link dynamically, and distribute such (closed) programs along the DLLs (or shared libs or what your OS uses)
<FromGitter> <sam0x17> that's good to know
<Papierkorb> The LGPL was literally developed for that purpose for Qt
<FromGitter> <sam0x17> that's cool
<FromGitter> <sam0x17> but yeah, still going to work on bringing CEF to crystal -- I totally get your perspective and the bad rap electron has -- a lot of that has to do with crazy bloaty decisions the electron project itself has made (thanks to influence from the atom team) and the fact that linux support doesn't get much love, but I want to be very different from them. I want this to be lightweight as possible, with linux + osx +
<FromGitter> ... windows treated equally support wise (once windows support is available).
<Papierkorb> It can't be lightweight. It got a whole fucking browser.
<Papierkorb> That's nowadays the polar opposite of lightweight
<FromGitter> <sam0x17> *as possible*
<Papierkorb> The JBoss ("Wildfly") guys are pissed, they want that anti-title back
<FromGitter> <sam0x17> lol, will have to look that one up
<Papierkorb> Application server for Java. If you want to know what the opposite of "lighweight" is defined as, it's JBoss.
<FromGitter> <sam0x17> hahaha gotcha
<RX14> enterprise bad java is so bad
<RX14> how do they manage to generate more XML config than it actually takes to write the functionality sanely
<RX14> and then 10x the xml config in code and useless interfaces and "ImplBuilderFactory" classes
<FromGitter> <sam0x17> yeah, similar experience if you ever try to write an android app
<FromGitter> <sam0x17> it's funny because nothing about Java forces you to be that way, other than an extremely verbose type system I suppose, but nothing about Java screams XML
<RX14> nothing like the good old InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState class
<FromGitter> <sam0x17> so true
<Papierkorb> RX14: Beans. Like .. Oh my god. Words don't describe my experience while working at a JEE shop.
<RX14> I love that thats a real class
<RX14> that someone wrote and thought
<RX14> thats OK
<RX14> lets review and merge thins
<RX14> lets review and merge this
<RX14> i've never had the unpleasantry to actually work with bad java Papierkorb
<Papierkorb> Ever wondered why I'm so adamant on architecture design? not even mad about that, but that's why.
<RX14> what do you mean by "architecture design"?
<FromGitter> <sam0x17> the art of not being like JEE
<Papierkorb> application/library/system/... design. as in, design that will be maintainable and extensible tomorrow and the day beyond. (Not saying I get it right in all ways lul).
<RX14> it's genuinely amazing how hard it actually is to do anything in such systems
<RX14> there was a maven resolver library I used once
<RX14> and it was just utterly impenetrable
<Papierkorb> maven aaaaaaaaahh
<RX14> maven is alright as a repository format
<Papierkorb> On how to make it complicated again to do dependency things
<RX14> and it's ok for small projects
<Papierkorb> at least gradle is easy to use
<RX14> Papierkorb, this was literally the repo format
<RX14> not maven the tool
<RX14> but yes gradle's pretty cool
<RX14> so I just realised that cmake FOO=bar is silently ignored
<RX14> and you need to use cmake -DFOO=bar
<Papierkorb> yup just like cc
<RX14> yeahhh
<RX14> i copied faulty instructions from txe
<RX14> and that was most of my day wasted
<RX14> i mean i'm still stumped
<Papierkorb> with WSL, can I just install crystal from the ubuntu mirror (or some targz), and then do stuff?
<RX14> because the grisu3 algorithm seems to have broken
<RX14> on windows only
<RX14> and that makes no sense and i dont get the algorithm either way
<Papierkorb> Dunno if I have enough space left in the VM, as Win10 by itself aleady ate 20GiBs for nothing. I mean, it installed clickbait games I didn't want..
<FromGitter> <sam0x17> if I had to convince a co-worker that javascript "callback hell" and "promises" can be largely or completely avoided in crystal.. would my argument basically be "blocks are extremely powerful" or is there something else I'm forgetting. In my own experience, I would have to say those are problems I only run into in js and not ruby or crystal, but I can't put my finger on why exactly... thoughts?
<RX14> it's not about blocks
<RX14> it's about fibers
<RX14> JS has one callstack
<RX14> and so to do concucrrency it needs to trace multiple threads of execution over one callstack
<RX14> crystal solves that problem super super simply:
<RX14> have multiple callstacks
<FromGitter> <sam0x17> that's awesome, I didn't realize crystal did fibers differently
<Papierkorb> Crystal borrowed blocks from Ruby. One of the large benefits is that Blocks allow you to think more in a pipeline, so you only look at one item at a time, and don't have to do the boring stuff.
<RX14> fibers are the differently
<RX14> nodejs doesn't have fibers
<FromGitter> <bew> they are starting to have them
<FromGitter> <bew> not the same
<RX14> @sam0x17 async/await is just a shitty way to create the illusion of fibers over promises
<FromGitter> <sam0x17> ah, hence my confusion, because I know I first heard of fibers in a js context
<RX14> the better solution is just to have fibers
<RX14> but nodejs already dug itself into a corner
<RX14> tell them it's the same way go does concurrency
<RX14> because it is
<Papierkorb> Blocks, once used by your own code, are insanely powerful, and insanely boring at the same time. They're nothing else than anonymous functions. The point is, the look&feel that they give in your code makes it great for writing clean and expressive code.
<RX14> indeed
<FromGitter> <drosehn> Well, let me try to change the topic to something mundane and probably stupid on my part...
<FromGitter> <drosehn> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a3ee1d6ba39a53f1a974903]
<FromGitter> <drosehn> I'm trying to figure out how to get Process.run() to work the way I'd like to use it for monitoring the output of some other program.
<FromGitter> <sam0x17> thanks guys
<FromGitter> <drosehn> What I have above works kinda-okay, but seems pretty lame.
<FromGitter> <drosehn> I have to put the `hproc.output.read_line` inside a `rescue`, because I don't know how to tell when I've read out of lines to read. Also, what I'd really like to do is be monitoring both STDOUT and STDERR streams, in real-time.
<FromGitter> <drosehn> At one point the `&& ! hproc.terminated?` seemed like a good idea, but it turns out that there can still be data to read when`hproc.terminated?` turns true. So that wasn't the right idea.
alex`` has quit [Quit: WeeChat 2.0]
<FromGitter> <drosehn> Seems to me there should be some method I could call to tell if there is anything to read from an `IO::FileDescriptor`. So I could be looping around doing something like ```cr
<FromGitter> <drosehn> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a3ee3a903838b2f2a2e3a03]
<RX14> looks like the APT repository is being fixes
<RX14> fixed*
<FromGitter> <drosehn> So what am I missing? I was hoping for something as simple to use as `IO.popen()` in ruby, but so far I haven't made much progress. And while the above works, it looks about 100 times uglier than using `IO.popen()`. for the kinds of things I want to do.
<FromGitter> <bew> I would suggest to use fibers, one the read stdout, one to read stderr of the running process
<RX14> @drosehn i'm not quite sure from the code what you actually want to do
<RX14> but if you want to monitor things in realtime, yes you want fibers
<FromGitter> <drosehn> ok
<FromGitter> <bew> and maybe another fiber to monitor the state of the process, and when it's terminated, send a message to a channel to notify who needs to know the process exited
<RX14> not too many fibers
<RX14> the one monitoring the process should be the one that spawned it ideally
<RX14> @Val, Papierkorb, @faultyserver APT should be fixed now
<Papierkorb> with 0.24.1?
<RX14> yep
<FromGitter> <drosehn> Well, I use this in a number of different programs, and what-I-want-to-do is different in different programs. here I was trying to write an example program which would show how to use all the flexibility which `Process.run()` seems to provide.
<RX14> i've never used popen
<RX14> but it surely has some way of handling stdout and stderr
<FromGitter> <drosehn> But basically I want to read lines which the program-being-run writes to stdout and stderr, parse them a line at a time, and make decisions based on what the program is writing.
<RX14> well you have 2 streams of information
<RX14> so you need concurrency
<RX14> so you need 2 fibers
<RX14> it's super variable how any of this works depending on the usecase
<RX14> whether you want to process out and err as seperate streams
<RX14> or to think of lines from each of them
<RX14> or if you even want to process them as a terminal does - as a single stream with both of them merged
<RX14> if youw ant that you might want to open an IO.pipe
<FromGitter> <drosehn> It's a very easy to use for stdout, and in some cases you can handle stderr by cheating and redirecting stderr to stdout. There's a number of nice use cases, but it is more limited than `Process.run`. And sometimes those limits are fine.
<RX14> and then use the same pipe filedescriptor for both stdout and stderr
<FromGitter> <jwaldrip> RX14: anything I can do to fix the socket build. If so... should I try to fix the Dockerfile in master? Or is the one is the distribution script the one that is being used to build the image on socket hub too?
<RX14> "socket build"?
<RX14> @jwaldrip well honestly we're all burned out from trying to release 0.24.1
<RX14> and i'm burned out from windows
<RX14> so it's not going to happen from the core team before the other side of christmas
<FromGitter> <jwaldrip> I know. I was offering to see if I could at least get it fixed in my fork.
<FromGitter> <jwaldrip> If that would help the core team. I’ve given up on getting an official 0.24.1 docket image before Xmas. But if I can help the effort before they come back, then I will.
<RX14> Papierkorb, guess what's more annoying than a segfault in pure logic code that only happens on windows?
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<RX14> an intermittent segfault in not-platform-specific not-IO code that only happens on windows
<Papierkorb> in debug mode, or release?
<RX14> debug
<RX14> Papierkorb, hillariously it seems to happen more often if you wait between executing the same binary
<RX14> so running it in a loop you get a high success rate
<RX14> running it in a loop with 20s intervals is a low success rate
<RX14> so thats like wtf-level bug already