ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.34.0 | 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
<oprypin> postmodern: Pointer.malloc is fully hooked to GC
<FromGitter> <ImAHopelessDev_gitlab> @j8r yeah, i think you can do primitives with random vertices. however, i've never done a 3d game so take my info with a grain of salt :D
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
darkstardev13 has quit [Ping timeout: 260 seconds]
darkstardevx has joined #crystal-lang
<FromGitter> <grkek> @asterite Do I still make the issue for the bug?
<FromGitter> <elorest> Is there a way to get the bytes from a struct without changing it to a pointer first? ⏎ ⏎ https://carc.in/#/r/8vku
ur5us has joined #crystal-lang
_ht has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
<oprypin> elorest: no. do you know that it can be different depending on hardware?
<FromGitter> <elorest> I know that the padding and Endianess could be. Are you saying the syntax would be too?
<FromGitter> <elorest> <oprypin> So the pointer syntax is `the only` way to get them? `b = Bytes.new(pointerof(t1).as(Pointer(UInt8)), sizeof(Test1))`
<oprypin> no; yes
<oprypin> huh does it work without casting to Void* first
<FromGitter> <elorest> *<oprypin>* :( ; :)
<FromGitter> <elorest> Yeah that code works on both ARM linux, x86 Mac and Linux.
<FromGitter> <elorest> It think in crystal casting it to `Pointer(UInt8)` is the same as Void in C.
<FromGitter> <elorest> I'll try void though.
<oprypin> why try it if your code already works πŸ™ƒ
<FromGitter> <elorest> Sometimes things work but for the wrong reason and later they don't lol. ⏎ ⏎ Like how `2**31-1` worked for ever in crystal and gave the correct result but now it throws an overflow exception. Obviously it is an overflow but since subtraction is technically an overflow operation anyway it technically gave the correct result.
ur5us has joined #crystal-lang
<FromGitter> <elorest> <oprypin> Anyway thanks. My pointer code works I was just trying to figure out if there was a way to do it without unsafe operations.
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 265 seconds]
claudiuinberlin has joined #crystal-lang
<hightower2> Hey folks, any plans to support crystal on ppc64?
ur5us has quit [Ping timeout: 260 seconds]
<oprypin> no, apparently
<oprypin> ok i spent too long producing this comment https://github.com/crystal-lang/crystal/issues/8381#issuecomment-612487955
<oprypin> i want thumbs up!!!!!!! validation!!! it's a good read though. about linux process exit codes and signals
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has joined #crystal-lang
gangstacat has quit [Quit: Ĝis!]
darkstardevx has quit [Ping timeout: 265 seconds]
<hightower2> Hey folks, in Crystal's file spec/llvm-ir/test.sh , The last "test memcpy.cr" block is an identical copy of the previous one. Is this a copy/edit error? Should one of them be for i686 or something, instead for x86_64 twice?
ur5us has quit [Ping timeout: 260 seconds]
<oprypin> hightower2, there are no identical lines in that file. memset.cr vs memcpy.cr
<FromGitter> <acook> At some point `YAML::Any#each` was removed, so now my app breaks. I can't find it mentioned in the changelog when or why it happened. `#each` is still mentioned on the documentation for `YAML::Any` but it's not actually there anymore. What is the new strategy for iterating through arbitrary YAML documents?
claudiuinberlin has joined #crystal-lang
<FromGitter> <acook> Here's the documentation https://crystal-lang.org/api/0.34.0/YAML/Any.html and screenshot of #each mention: https://imgur.com/hwJnp3b
xybre has joined #crystal-lang
<oprypin> acook, i'll look at git blame for u
<oprypin> acook, no wait.. that `#each` was never there
<oprypin> acook, this was changed on Jan 15, 2018 !
<FromGitter> <acook> Weird, my app was last compiled after that. I must have been using an old compiler. Now I'm on 0.34.0
<oprypin> #5183 in changelog
<oprypin> acook, anyway, now u need to iterate over explicitly whether its Array or Hash
<oprypin> so change `.each` -> `.as_a.each` , identical otherwise
<FromGitter> <acook> Thanks for identifying that issue on github, I was grepping through the commits trying to figure out where it happened and why.
<FromGitter> <acook> I can see from the discussion there that arbitrarily iterating over an unknown data structure could have different an unexpected results. It's less immediately convenient but I get why. If there are different types expected I can do an `is_a?` or a type switch or something.
<FromGitter> <acook> I'll have to look into the lower level APIs they mention in that thread, but after the app is working again.
<oprypin> u can consider PullParser too
<oprypin> that answer i posted is for kinda arbitrary structure
<oprypin> u can use `Any.raw` too
<jhass> or map out the structure using YAML::Serializable
<FromGitter> <acook> It looks like Crystal also lost the File::Stat type and it became File::Info. Looks like that change could be good for portability. I'm looking forward to being able to compile things for Windows.
<oprypin> well u can compile *things*
<FromGitter> <acook> Here's where that change happened, around the same time https://github.com/crystal-lang/crystal/pull/5584
<oprypin> just not very useful things
<FromGitter> <acook> haha
<FromGitter> <acook> Able to compile my existing programs I mean, and have them work as expected :)
<FromGitter> <acook> I wrote a clone of Ruby's Pathname in Crystal with a few tweaks, that's what uses File::Stat. I appreciate that Crystal is building better tools and not just throwing them in. I'm fine building my own hacks in the meantime. I do like the kind of things I can do with Pathname. And Crystal's Path is becoming pretty interesting.
<FromGitter> <acook> Ah, the downside of the `YAML::Any#as_h` is that I can no longer use the same code for other types. I'll have to ensure that the YAML is already converted to a Hash earlier in the process.
<oprypin> acook, crystal has that now. https://crystal-lang.org/api/Path.html
<jhass> there's something pathname like in stdlib now, Path
<FromGitter> <acook> Yeah that's what I meant by "Crystal's Path", but right now it's mostly just the parsing of paths themselves
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <stronny> @oprypin very nice job with signals there
<FromGitter> <stronny> and wait values I mean
<FromGitter> <stronny> that would be another interesting thing to port lol
<FromGitter> <stronny> maybe something like this? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e9309f7e7ca460b0655b346]
<FromGitter> <stronny> that would force user to check the nature of the event and use appropriate methods to extract meaningful values
gangstacat has joined #crystal-lang
<FromGitter> <acook> Interestingly, if I don't put the `.as_h` right after the `.parse` then Crystal thinks the value could be an array or a hash, even though it's never mutated. Pretty weird.
<FromGitter> <acook> Oh I see why, nvm. I did something farther up to set the default value.
postmodern has quit [Quit: Leaving]
<repo> hey Blacksmoke16! i saw you made a pr about better uuid support in granite. I'm struggling to set up uuid primary keys with postgres in granit. I get an error: Error: no overload matches 'Granite::Type.from_rs' with types PG::ResultSet, UUID.class
<FromGitter> <Blacksmoke16> Are you using a converter?
<repo> no, but i just think i figured it out from the specs
<repo> onverter: Granite::Converters::Uuid(String)
<FromGitter> <Blacksmoke16> Ye
<repo> not quite clear from the docs though
<FromGitter> <Blacksmoke16> Probably could be updated for sure
claudiuinberlin has joined #crystal-lang
<repo> Blacksmoke16: i don't see any docs regarding transactions...
<repo> i want to wrap creating a token and a corresponding refresh token into a transaction
<FromGitter> <Blacksmoke16> i think you can get it off the model class
<FromGitter> <Blacksmoke16> something like
<FromGitter> <acook> Wow those Errno changes are nice. They felt super unwieldy before and now I feel like there's actual integration.
<FromGitter> <Blacksmoke16> ```Model.adapter.database.transaction do |tx| ⏎ ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5e931f11c52b6a38abdec5a1]
<FromGitter> <acook> Is there a native interface to C.ioctl yet?
<FromGitter> <acook> Calling `C.ioctl` isn't a huge deal, but I'd like to wrap it in a better API
<repo> Blacksmoke16: ah ok, and then all write operations automatically operate on the tx?
<FromGitter> <Blacksmoke16> so yea, should just work and rollback on any exceptions
<repo> ok nice
<repo> thanks!
<repo> ah :( granite doesn't support preloading associations
<repo> so far crecto is still the most feature complete orm i've seen
<repo> but it has some flaws which prevent me from using it for this
<FromGitter> <acook> Looks like there was an old discussion about terminal libraries, someone saying it was "impossible" to write cross-platform ways to get terminal sizes in Crystal specifically. Bizarre. My code works fine, I ported it from one of my Ruby gems, and it works on every unix-like OS. The magic numbers are annoying but not that big of a deal. Anyway, I assume the decision to keep that kind of thing as a shard is still
<FromGitter> ... the case?
<hightower2> repo Check also avram from the lucky project
<hightower2> acook what code do you use?
<repo> hightower2: i love avram but it's really annoying to use in a project separate from lucky
<repo> hightower2: also it doesn't currently even support ORing wheres
<repo> at least not when i last checked
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
xybre is now known as acook
<acook> hightower2, what code? I don't think I understand
<repo> hmm
<repo> Error: no overload matches 'Redo::Api::Models::AuthorizationCode.create!' with type Hash(Symbol, Granite::Base | Redo::Api::Enums::CodeChallengeMethod | Slice(UInt8) | Nil)
<FromGitter> <Blacksmoke16> id advise against using `create!`, probably best to just define a custom initialize to handle what you want to do
<FromGitter> <Blacksmoke16> if you got some sample code i could prob give a better solution
<repo> hm
<repo> sorry i'll put them in one multipaste
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <Blacksmoke16> https://github.com/amberframework/granite/pull/370 would fix it, so i would just define an initialize like you normally would versus relying on some backend magic
<repo> ic
<FromGitter> <Blacksmoke16> i.e. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e9327b8e24b4d6c4401e89f]
<repo> sure
<FromGitter> <Blacksmoke16> could also probably do something like
<FromGitter> <Blacksmoke16> create your own `create!` class method that just forwards to initialize, then calls `.save!` on the instance
<repo> yeah
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
<FromGitter> <Blacksmoke16> find anymore bugs? :p
<repo> not right now
<FromGitter> <Blacksmoke16> πŸ‘
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<oprypin> mm nice, i just realized that i can format && commit in one line
<oprypin> `[[ ! $(crystal tool format) ]] && git commit`
<oprypin> actually this is silly. i dont need to care whether it was already formatted. better check for errors
<oprypin> `crystal tool format && git commit` 🀦
acook has quit [Ping timeout: 250 seconds]
<FromGitter> <Blacksmoke16> could do `crystal tool format --check` if you dont actually want to commit the fixes
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#241c0ee (master - Merge pull request #9021 from oprypin/winstatus): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/674088029
travis-ci has left #crystal-lang [#crystal-lang]
<oprypin> Blacksmoke16, thx, also much better than what i concocted 🀦
<FromGitter> <Blacksmoke16> πŸ‘ np
<oprypin> stronny, thats a very good idea about Status+struct. u should post it on https://github.com/crystal-lang/crystal/issues/8381
<oprypin> i was thinking similarly in terms of enums. but this is more direct. what they call it, algebraic types? lol
<oprypin> i might actually literally copy that code snippet into a pull request :o it's so good
Vexatos has quit [Remote host closed the connection]
Vexatos has joined #crystal-lang
xybre has joined #crystal-lang
xybre is now known as acook
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> crystal-lang/crystal#2178457 (master - Add support to jquery version 3 (#9028)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/674105353
DTZUZU2 has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
<wmoxam> I've submitted an updated OpenBSD port for Crystal/Shards (finally!): https://marc.info/?l=openbsd-ports&m=158671082007399&w=2
DTZUZU has quit [Ping timeout: 265 seconds]
<karchnu> wmoxam: wait, you did port 0.34 on openbsd?
<wmoxam> yep
<karchnu> that's awesome, I just worked a whole night on it and still having a few linker problems :) Thanks!
<wmoxam> I had trouble with 0.32 and 0.33, but 0.34 went pretty smoothly
<wmoxam> karchnu: This is on the latest OpenBSD snapshot. I haven't tested on 6.6
<karchnu> wmoxam: I tried to cross-compile it from a fresh alpine, but I suspect LLVM/Clang not to be compiled with the same parameters on both sides (but 8.0.1 on each side)
<wmoxam> ah
<karchnu> wmoxam: that's okay, I will just wait for the next release
<FromGitter> <smprather> hi Pros. i'm having a problem with an Alpine Docker static build. when i get to the end of reading a file, i'm getting "Invalid memory access (signal 11) at address 0x0" on the next fh.read_line, instead of an exception that i normally handle w/ begin/rescue/end. no problem with a regular non-Docker build. ideas for a workaround?
<FromGitter> <smprather> i just tried removing --static from the Docker build. it works ok when i do that. bummer, i was hoping to get away from doing a different build for each Redhat version i support and a wrapper script to dispatch to the proper platform exec. my static "Hello World" test worked on all platforms, so i was jazzed.
<FromGitter> <Blacksmoke16> got some sample code that reproduces the issue?
<FromGitter> <Blacksmoke16> using MT at ll?
<FromGitter> <Blacksmoke16> all*
<FromGitter> <smprather> i do use MT, but not in this area of the code. let me try to cut it down to the bare minimum that it takes to get a fail...
<FromGitter> <Blacksmoke16> πŸ‘ probably a good step
<FromGitter> <Blacksmoke16> and to be clear, MT being enabled would make anything that uses fibers be MT enabled
<FromGitter> <Blacksmoke16> as its just based on fibers and `spawn` keyword
<FromGitter> <smprather> `f = File.open("test.cr") ⏎ begin ⏎ loop do ⏎ ⏎ ```f.read_line``` ... [https://gitter.im/crystal-lang/crystal?at=5e935294e24b4d6c4402541d]
<FromGitter> <smprather> hmm.. my attempt at markdown failed a little, but you get the idea
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/File.html#each_line(filename,encoding=nil,invalid=nil,chomp=true,&)-class-method might be better?
<FromGitter> <smprather> `sudo docker run --rm -it -v $PWD:/workspace -w /workspace crystallang/crystal:0.32.1-alpine crystal build test.cr --static`
<FromGitter> <smprather> there's a reason i was using that kind of loop, but i'm sure i can get away from it. let me try each_line...
<FromGitter> <smprather> regardless, there appears to be a Crystal bug floating around here somewhere...
<FromGitter> <smprather> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e9353eb38198d56a199aa98]
<FromGitter> <smprather> yep, that worked ok. great, i'll switch to it. you think this is worth a Crystal bug report?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e935434c52b6a38abdf481a]
<FromGitter> <Blacksmoke16> this prints ⏎ ⏎ ```sdf ⏎ ⏎ sdf ⏎ ⏎ sd``` ⏎ ⏎ (which is correct) [https://gitter.im/crystal-lang/crystal?at=5e93544138198d56a199ab2f]
<FromGitter> <Blacksmoke16> so if i had to guess, it isnt respecting EOF?
<FromGitter> <smprather> you used Docker/Alpine/static?
<FromGitter> <Blacksmoke16> yes
<FromGitter> <Blacksmoke16> on linux ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e935470f450c25cc8d61f36]
DTZUZU has joined #crystal-lang
<FromGitter> <smprather> right, my static build doesn't appear to be throwing the exception at EOF
<FromGitter> <smprather> it just segs
DTZUZU2 has quit [Ping timeout: 265 seconds]
<FromGitter> <Blacksmoke16> so yea, not handling EOF on alpine, id prob file it?
<FromGitter> <smprather> cool. thanks man!
<FromGitter> <smprather> btw, i am limited to Crystal 0.32 since the Docker/Alpine guy hasn't created a 0.33 yet.
<FromGitter> <Blacksmoke16> there is a `0.34.0` alpine image?
<FromGitter> <Blacksmoke16> not sure what you mean
<FromGitter> <smprather> ummm
<FromGitter> <smprather> this is the Docker image
<FromGitter> <smprather> crystallang/crystal:0.32.1-alpine
<FromGitter> <Blacksmoke16> right, there are also `0.33.0` and `0.34.0` images
<FromGitter> <smprather> i tried setting it to 0.33, no dice. same for 0.34.
<FromGitter> <Blacksmoke16> what error do you get?
<FromGitter> <Blacksmoke16> `crystallang/crystal 0.33.0-alpine 5ee23104cacd 7 weeks ago 280MB`?
<FromGitter> <Blacksmoke16> i deff have them downloaded so yea
<FromGitter> <smprather> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e9355625d148a0460fff9c9]
<FromGitter> <Blacksmoke16> right `0.33.0` not `0.33.1`
<FromGitter> <Blacksmoke16> πŸ˜†
<FromGitter> <smprather> ahhhh!!!!
claudiuinberlin has joined #crystal-lang
<FromGitter> <smprather> GAHHHH!!! no seg with 0.34
<claudiuinberlin> hello, there is any list of features + performance that I could show them to my team?
<FromGitter> <Blacksmoke16> really?
<claudiuinberlin> I am the CTO of a small berlin startup(~40 devs)
<claudiuinberlin> and i would like to have a small project
<claudiuinberlin> in crystal
<FromGitter> <Blacksmoke16> @smprather i was using 0.34.0, so sure something else isnt going on?
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e93563fd021c45cc7df68cd]
<FromGitter> <smprather> @Blacksmoke16 Yep, appears to be ok. I'll go back to full app and see how it goes...
<claudiuinberlin> but before goin there, I wan to prepare myself, and present some nice stuff to have :)
<FromGitter> <Blacksmoke16> what kind of project?
<claudiuinberlin> have no idea
<claudiuinberlin> sorry to be blunt
<claudiuinberlin> we have a desktop app, an api plus a web app :)
<FromGitter> <Blacksmoke16> ah, just want to do *something* in crystal then πŸ˜‰
<claudiuinberlin> yes,
<claudiuinberlin> but, I want to touch crystal featurs and assets
<claudiuinberlin> aka, building an API... is not important, as we already know to make it in ruby, java or go :)
<claudiuinberlin> for desktop app, we have python with QT
<FromGitter> <Blacksmoke16> API Docs - https://crystal-lang.org/api/master/index.html ⏎ Reference - https://crystal-lang.org/reference/
<claudiuinberlin> I was thinking to rebuild du -h :) from linux, but then I have to read a lot of c :)
<FromGitter> <Blacksmoke16> are plenty of web frameworks out there
<FromGitter> <smprather> @Blacksmoke16 Never mind, i didn't re-create my test loop correctly. fixed. now it still segs. i'll file bug. thanks for all the help (esp fixing my bonehead to get me to 0.34.0)!
<FromGitter> <Blacksmoke16> np
Human_G33k has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> in reality tho, id try to use `.each_line`, using higher level iterators is usually the way to go
<FromGitter> <Blacksmoke16> unless there is a reason to go lower
Human_G33k has joined #crystal-lang
<FromGitter> <smprather> well, like i said, i had a reason to use that, but honestly, it wasn't a very strong one. going to each_line is no big deal.
<FromGitter> <Blacksmoke16> πŸ‘
<FromGitter> <Blacksmoke16> mainly its more stable, tested, and can sometimes come with perf bonuses as optimizations can be built in
alexherbo2 has joined #crystal-lang
<acook> I don't suppose there's a way to re-namespace two shards which use the same module/class name internally?
<FromGitter> <Blacksmoke16> i.e. ⏎ ⏎ shard1 ⏎ SomeModule::Klass ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5e9358a41aaf8e4b8e7a5123]
<FromGitter> <Blacksmoke16> are they not namespaced by the shard name?
<raz> speaking shard, i wish it would fetch the deps in parallel
<raz> i measured it and this would make me 4.15% more productive
<claudiuinberlin> there is a way to list all the methods for a given class module?
<claudiuinberlin> in python dir(x), or ruby x.methods
<FromGitter> <Blacksmoke16> in a macro yes, `{{pp MyKlass.methods.map &.name}}`
<claudiuinberlin> thx
<FromGitter> <acook> @Blacksmoke16 No, they're namespaced by whatever code they put in the shard. In this case, they named both of their top level classes `Magic`.
<FromGitter> <Blacksmoke16> ouch
<FromGitter> <acook> Even though the repos and listed name in the shard.yml are different.
<oprypin> acook, does `module M; require "foo"; end` work? :thinking:
<FromGitter> <Blacksmoke16> what are the shards?
<FromGitter> <Blacksmoke16> id be surprised if it did
<FromGitter> <smprather> @Blacksmoke16 You reminded me that i hadn't added -Dpreview_mt to my build Docker command. but when i do: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e935da85d148a0460001049]
<FromGitter> <acook> I'll check, if require inside a module would namespace things that would be awesome
<FromGitter> <Blacksmoke16> @smprather thats expected atm, see https://github.com/crystal-lang/crystal/issues/9011#issuecomment-609812958
<FromGitter> <Blacksmoke16> is there a reason to use both?
<FromGitter> <acook> Nope. `Error: can't require inside type declarations`
<FromGitter> <acook> I wanted to do an incremental switchover from one library to the other and do some testing between them before going all in. But they clobber some of each other's constants and Crystal won't let them be redeclared even if they're set to the same value.
<FromGitter> <Blacksmoke16> :/
<FromGitter> <acook> It's not a huge changeset, I just wanted to see the output side by side in the same binary.
<FromGitter> <acook> I humbly request that we be allowed to do something like `module M; require "foo"; end` or `require "foo" as Bar`.
<FromGitter> <smprather> @Blacksmoke16 gotcha. i figured i wasn't the first to come across this. i hope it is resolved soon. i have to parse two files that can be many GB in size. i want to parse each in a thread. but it looks like i'll have to wait a while before i can do it with the Holy Grail static link (i'm sick of building separate for each platform).
<FromGitter> <Blacksmoke16> ES6 style imports would be nice yes
<FromGitter> <Blacksmoke16> one can dream :p
<oprypin> yea this is a mess
<FromGitter> <acook> But it seems like the way the Crystal compiler currently works that it's not just a semantic change, it'd likely have to approach the process of requiring different and that might make reopening classes weird. Like, if I do a `module M; require "foo"; end` and a normal `require "foo"` in the same file and reopen `module Foo` do both change or are they essentially instances?
<FromGitter> <Blacksmoke16> namespacing is good, but only ways to avoid long names in code are aliases, or including that module (and all its methods etc) into another namespace
<FromGitter> <Blacksmoke16> the former is doable for common stuff you need, but the latter is less than ideal
darkstardevx has joined #crystal-lang
<FromGitter> <acook> Yeah I think aliases is a fine way to go, but it'd still require reworking the compiler's internals so two different files that declare the same name are considered separate entities instead of reopened. That could be a big change. I haven't looked at the compiler yet, so I might be wrong.
ht_ has joined #crystal-lang
<FromGitter> <smprather> i found another one: `FileUtils.rm("#{@log_file}.bak") rescue nil` --> `Invalid memory access (signal 11) at address 0x0`
_ht has quit [Ping timeout: 265 seconds]
ht_ is now known as _ht
<oprypin> smprather, wait what's the context on that?
<FromGitter> <smprather> and Crystal has not implemented Ruby's FileUtils.rm_f :(
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/FileUtils.html#rm_r(path:String):Nil-instance-method
<FromGitter> <smprather> that file does not exist, so the thrown exception is not rescued. oh, another context is that this is Docker/Alpine/Static build. local-host dynamic is ok.
<FromGitter> <smprather> still getting it with rm_rf. foo_bar does not exist. ⏎ ⏎ ``` FileUtils.rm_rf("foo_bar")``` [https://gitter.im/crystal-lang/crystal?at=5e93637d16f84f046172dbfe]
<FromGitter> <Blacksmoke16> `rm_r`
<FromGitter> <Blacksmoke16> not `rm_rf`
<FromGitter> <Blacksmoke16> someone needs more β˜• :P
<FromGitter> <smprather> what's wrong with rm_rf? i want to ignore errors.
<FromGitter> <Blacksmoke16> oh, https://crystal-lang.org/api/master/FileUtils.html#rm_rf(path:String):Nil-instance-method that one exists too
<FromGitter> <smprather> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e9363de16f84f046172dc9e]
<FromGitter> <smprather> seems there is some fundamental piece of Crystal code that is not throwing exceptions when it should.
<FromGitter> <smprather> (and only when Alpine/static)
zorp has quit [Ping timeout: 258 seconds]
<FromGitter> <smprather> i'll try wrapping with File.exists?
<FromGitter> <smprather> yep, that works. seems the problem is bigger that just File#read_line.
zorp has joined #crystal-lang
<FromGitter> <smprather> so i can compile static and run full app now. cool. just not with MT πŸ’© (yet).
<FromGitter> <Blacksmoke16> #progress
<FromGitter> <smprather> @FromIRC IMO, the assets are: you get to write Ruby'ish code and it is blazing fast including multi-threading (* see intertwined conversation for at least one caveat).
ur5us has joined #crystal-lang
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #crystal-lang
<repo> too bad instance variable types can't be inferred by an assignment with .as(Type)
<oprypin> hm yea
<repo> i'm in a situation where i can set these instance variables only after all other instance variables have been defined
ua has quit [Ping timeout: 264 seconds]
<FromGitter> <ondreian> I'm having a problem writing raw `Bytes` instance to a `TCPSocket`, as soon as I do, I am unable to perform `socket.gets` anymore
ur5us has quit [Ping timeout: 260 seconds]
<oprypin> ok, u wanna talk about it?
<claudiuinberlin> if I import @[Link(framework: "Foundation")] , how do I call from example the method: NSUserName(), from FileManager class?
<claudiuinberlin> sorry to just ask random questions
<oprypin> claudiuinberlin, uh what i dont think there are classes
<oprypin> is this objectivec? not supported
<claudiuinberlin> ok thx
zorp has quit [Ping timeout: 258 seconds]
<FromGitter> <asterite> I think it's possible to call objectivec methods, there were some experiments... but you need to call functions in a different way, I can't remember
ur5us has joined #crystal-lang
<claudiuinberlin> another question, in ruby you could do [].map {|x| x.foo} or method(x)
<FromGitter> <Blacksmoke16> `[].map &.foo`?
<FromGitter> <Blacksmoke16> would call `#foo` method on each item in the array
<claudiuinberlin> what is & in crystal, a proc?
<claudiuinberlin> aaa
<FromGitter> <Blacksmoke16> same as `.map &:foo` in ruby
<claudiuinberlin> and if I want to use it in a method, aka [].map{|x| some_method(x)}
<FromGitter> <smprather> @Blacksmoke16 I was going to report the bug, but it looks like it has already been done. It relates to *any* exception unrolling. https://github.com/crystal-lang/crystal/issues/4276
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <Blacksmoke16> ah, well that would do it
<FromGitter> <Blacksmoke16> `[].map &->some_method(String)`
<FromGitter> <Blacksmoke16> assuming the array is `Array(String)`
_ht has quit [Quit: _ht]
<FromGitter> <ondreian> With regards to my `Bytes` & `TCPSocket` issue, I just made this reduced playground sample that demonstrates what I'm doing and some comments about what I problem I am having: https://play.crystal-lang.org/#/r/8voi
<FromGitter> <ondreian> I have a working ruby implementation and the `Bytes` objects themselves are the same
claudiuinberlin has joined #crystal-lang
<oprypin> ondreian, maybe you need `flush` / `sync`
hpyc9 has quit [Quit: ZNC 1.7.5 - https://znc.in]
hpyc9 has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
mistergibson has joined #crystal-lang
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
<FromGitter> <stronny> @ondreian I would look at tcpdump to confirm what bytes actually go and come
<FromGitter> <stronny> had a weird bug *twice* when some bytes were leaving early in separate packages (that was a bit of a problem because my task was to measure latency heh)