ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <Blacksmoke16> ```arr.replace [1, 2, 3] ⏎ ⏎ # versus ⏎ ⏎ arr = [1, 2, 3]``` ⏎ ⏎ I [https://gitter.im/crystal-lang/crystal?at=603840e7e0d7284c735c20b2]
<FromGitter> <Blacksmoke16> is there any actual difference between these?
<FromGitter> <Blacksmoke16> i guess `replace` would retain the same array so would be a bit more performant?
<FromGitter> <jrei:matrix.org> The reference
<straight-shoota> yeah
<FromGitter> <jrei:matrix.org> `arr.replace other` vs `arr = other`
<FromGitter> <Blacksmoke16> makes sense, thanks
<FromGitter> <jrei:matrix.org> in the first case `arr.object_id != other.object_id`, and the second `arr.object_id == other.object_id`
<FromGitter> <jrei:matrix.org> same for `#dup` - keep the reference and reuse the buffer
<FromGitter> <Blacksmoke16> @alexherbo2 I think you were asking for this. https://github.com/Blacksmoke16/oq/pull/73 if you wanted to test it out. Will get it released soon
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=603850636c077b203578c680]
<FromGitter> <Blacksmoke16> example usage
_whitelogger has joined #crystal-lang
tskalyo has left #crystal-lang ["User left"]
duane has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
_whitelogger has joined #crystal-lang
woodruffw has quit [Ping timeout: 272 seconds]
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
duane has quit [Ping timeout: 276 seconds]
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
woodruffw has joined #crystal-lang
woodruffw has quit [Ping timeout: 240 seconds]
woodruffw has joined #crystal-lang
_ht has joined #crystal-lang
alexherbo2 has joined #crystal-lang
hendursa1 has joined #crystal-lang
hendursaga has quit [Ping timeout: 268 seconds]
<FromGitter> <alexherbo2> how to parse a recursive `Array(Argument).from_json(STDIN)`?, with `Argument` being an alias to `Nil | Bool | Int32 | String | Array(Argument)`
<FromGitter> <alexherbo2> I tried with a recursive alias, but it does not work, because the JSON parser cannot do `Argument.class`
<FromGitter> <alexherbo2> I tried with a struct with a value property, and include `JSON::Serializable` but then my json string has to be `[{"value": 2}]` instead of `[2]` for example
<FromGitter> <alexherbo2> my struct was like
<FromGitter> <alexherbo2> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=6038bc2ce8267a46f2d9c3b6]
<FromGitter> <alexherbo2> @Blacksmoke16 thanks for the snippets
alexherbo2 has quit [Ping timeout: 264 seconds]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #crystal-lang
alexherbo28 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo28 is now known as alexherbo2
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #crystal-lang
<straight-shoota> probably best to define a custom json converter
<straight-shoota> i.e. a `from_json` method that looks at the parser token and decides what type to parse
<FromGitter> <Blacksmoke16> at this point wouldnt `JSON.parse STDIN` be better
<FromGitter> <Blacksmoke16> given it sounds like there is not structure to the data
Human_G33k has quit [Quit: Leaving]
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 256 seconds]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
duane has joined #crystal-lang
sorcus has quit [Quit: WeeChat 3.0]
sorcus has joined #crystal-lang
alexherbo2 has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
<FromGitter> <Blacksmoke16> ```5...10.times do |i| ⏎ puts i ⏎ end``` ⏎ ⏎ I feel like this should be a syntax error... [https://gitter.im/crystal-lang/crystal?at=60394a65e562cf54ac8629fe]
<FromGitter> <lodenos> Hey Guy’s I note a wierd behavior with BigDecimal ⏎ if divise ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=60394bfd95e23446e4fc11d2]
<FromGitter> <lodenos> Hey Guy’s I note a wierd behavior with BigDecimal ⏎ if I divise a / b ⏎ ⏎ ```a = BigDecimal.new 3.00000001 ⏎ b = BigDecimal.new 1.1111111 ⏎ ⏎ puts a / b``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=60394c97e8267a46f2db7dc2]
<FromGitter> <lodenos> How solve this issue ?
<FromGitter> <Blacksmoke16> did you try just doing `3.0`?
<FromGitter> <lodenos> Yes doesn’t work
<FromGitter> <Blacksmoke16> rip
<FromGitter> <Blacksmoke16> seems like some issue with the `@scale` ivar, as it's `UInt64`
<FromGitter> <Blacksmoke16> i.e. `0_u64 - 1` underflow
<FromGitter> <oprypin:matrix.org> @lodenos: please just report a bug then :>
<FromGitter> <Blacksmoke16> ^
<FromGitter> <lodenos> It’s work if I put @scale
<FromGitter> <lodenos> @oprypin:matrix.org yes I go to write this issue on github
alexherbo2 has joined #crystal-lang
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
richbridger has joined #crystal-lang
_ht has quit [Remote host closed the connection]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<straight-shoota> yeah `scale = @scale - other.scale` is a classic example why doing math with unsigned integers is harmful
<straight-shoota> the worst about it: the Rust implementation that our's is based on uses a signed i64 for scale :(
robertmeta has joined #crystal-lang
<FromGitter> <asterite> I wonder how we'll fix that uint32 bug... Maybe it was a bug all a long but llvm 11 made it always trigger
<straight-shoota> does it only happen with uint32? No other type?
<straight-shoota> I can't reproduce your reduced example with LLVM 9 but I suppose that's expected
<FromGitter> <asterite> Yes, it only happens on llvm 10 or later
<FromGitter> <asterite> I'm almost sure it has to do with union types being assigned to larger union types, but it's strange that it's not always reproducible
<FromGitter> <asterite> Or maybe string parsing is unsafe and does something bad... But so far I couldn't find anything
<FromGitter> <asterite> Also I had an example that fails, but also runs fine with prelude empty
<FromGitter> <asterite> I guess with time we'll find the answer... Too bad it blocks 1.0. Though maybe we can introduce a workaround just so that the compiler can work fine for these cases, and just consider this a bug with int unions, which isn't used that often
<straight-shoota> hm, maybe it's really an LLVM bug in the end... :/
<straight-shoota> but to confirm that we'd still need to figure out what exactly is going wrong
<FromGitter> <Blacksmoke16> Would it be easier to fix llvm12 support and try with that