<FromGitter>
<kingsleyh> hi - is it possible to specify multiple scripts for postinstall for shards? the examples only show a since postinstall
return0e has joined #crystal-lang
Yxhuvud has quit [Ping timeout: 265 seconds]
chachasmooth_ has quit [Ping timeout: 246 seconds]
chachasmooth has joined #crystal-lang
<FromGitter>
<j8r> @tenebrousedge is right
<FromGitter>
<j8r> @ezrast_gitlab In you example, I don't get why you use tap nor `b2 = b`
<FromGitter>
<j8r> maybe it's a typo, because doing `(b = b2).tap { b += 5hours }` won't modify `b`
<FromGitter>
<j8r> It could be possible to modify an ivar of `Time`, but the object is made immutable
ur5us has quit [Ping timeout: 248 seconds]
chachasmooth_ has joined #crystal-lang
chachasmooth has quit [Ping timeout: 272 seconds]
alex` has joined #crystal-lang
alex` is now known as Guest56192
Guest56192 is now known as alex``
<alex``>
I have a question about the option parser; if I want to add a command-line program with default options `<program> --<option> <value>`, does adding the same option after override it?, i.e. `<program> "$@" --<option> <value>` vs `<program --<option> <value> "$@"`
<alex``>
some option could cumulate, I don’t know if it is possible, for example passing multiple options like `git -c option1=value -c option2=value`
<alex``>
does it run multiple times, or a single
<FromGitter>
<Blacksmoke16> @kingsleyh not directly, but you can do like `make && make something_else && make install` etc
<FromGitter>
<mavu> Is anyone here using scry with CoC in vim?
melthelesbian has quit []
melthelesbian has joined #crystal-lang
dostoyevsky has joined #crystal-lang
alexherbo2 has joined #crystal-lang
return0__ has joined #crystal-lang
return0e has quit [Ping timeout: 265 seconds]
<FromGitter>
<ezrast_gitlab> @j8r I'm not actually trying to solve a problem anymore; I just don't understand why `a` and `b` behave inconsistently here, and why line 14 gives the value of `c` rather than `c2`: https://carc.in/#/r/8ikr
<FromGitter>
<j8r> @ezrast_gitlab what is inconsistent?
<FromGitter>
<j8r> for me it is
<FromGitter>
<tenebrousedge> I was going to contrast that with the Int#+ method, but apparently those are handled by LLVM directly
<FromGitter>
<j8r> avoid avoid different scoped variable having the same name
<FromGitter>
<ezrast_gitlab> @j8r `a.tap` returns the old value of a, `b.tap` returns the new value of b, and `(c2 = c).tap` returns a value that never belongs to c2 at all
<FromGitter>
<straight-shoota> In your examples `tap` actually has no effect on anything. It just yields `self` to the block which isn't used as a block argument.
<FromGitter>
<straight-shoota> `p x .tap { x += y }` is equivalent to `p x; x += y`
<FromGitter>
<tenebrousedge> except that `Time` can be mutated by the block and `Int32` can't
<FromGitter>
<ezrast_gitlab> @tenebrousedge += doesn't mutate; it makes a copy and reassigns the variable
<FromGitter>
<straight-shoota> Yeah, that was simplified.
<FromGitter>
<tenebrousedge> @ezrast_gitlab is there some other operative definition of mutation here?
<FromGitter>
<straight-shoota> The point is, this has nothing to do with blocks.
<FromGitter>
<tenebrousedge> who said it did?
<FromGitter>
<straight-shoota> The examples all use `tap`
<FromGitter>
<tenebrousedge> because it returns `self`
<FromGitter>
<straight-shoota> Yes, it can be used for demonstration, but it's not that cause
<FromGitter>
<tenebrousedge> and the difference is that `self` with the integers will always be the same value, where `self` with a `Time` object can have a different value
<FromGitter>
<straight-shoota> I understood that this was the assumption
<FromGitter>
<straight-shoota> Int32 is a primitive and Time is a struct. `+=` on a primitive really just assigns a new value.
<FromGitter>
<tenebrousedge> right
<FromGitter>
<straight-shoota> But calling methods on a struct to modify its properties actually does some magic to actually alter the existing struct's value instead of assigning a completely new struct
* FromGitter
* tenebrousedge nods
<FromGitter>
<straight-shoota> So it behaves a bit like a reference
<FromGitter>
<ezrast_gitlab> 1) doesn't modify in place though
<FromGitter>
<ezrast_gitlab> should be: + doesn't modify in place though
<FromGitter>
<straight-shoota> Yeah that's not what you'd expect from a `+` method
<FromGitter>
<straight-shoota> `+` returns an altered instance, `+=` assigns the altered instance
<FromGitter>
<tenebrousedge> so I can't speak to how Crystal/LLVM handles these things, but in Ruby integers are not objects in the same sense that everything else is; they're more like locations in memory that are interpreted as numerical values. There is no way to change what that memory value represents, so `+=` doesn't do that
<FromGitter>
<tenebrousedge> `+=` is something that happens to the variable, not to the underlying object
<FromGitter>
<straight-shoota> Structs are objects but on the stack. So technically, they'd behave like primitives. But there are a few extra rules in the language that alter that behaviour to make it better usable. When you call a method on a struct which changes its internal state, that change should not only affect a copy but the original value where the method was called on.
return0__ has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
melthelesbian has quit [Ping timeout: 252 seconds]
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Client Quit]
ur5us has joined #crystal-lang
<FromGitter>
<ezrast_gitlab> So `Time` and `+` were a distraction and I apologize for not factoring them out earlier. This is 100% a bug: https://play.crystal-lang.org/#/r/8im3
_ht has joined #crystal-lang
<FromGitter>
<straight-shoota> Yeah, `self` in `#tap` references a stack value when it's no longer available.
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
<FromGitter>
<dscottboggs_gitlab> First I've heard of it. Looks pretty nice at first-glance
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 260 seconds]
sagax has quit [Remote host closed the connection]
sagax has joined #crystal-lang
melthelesbian has joined #crystal-lang
lunarkitty has quit [Ping timeout: 245 seconds]
lunarkitty has joined #crystal-lang
ur5us has quit [Ping timeout: 245 seconds]
ur5us has joined #crystal-lang
chachasmooth_ has quit [Quit: Quit]
chachasmooth has joined #crystal-lang
<FromGitter>
<PercussiveElbow> Does anyone know if the XML stdlib module isn't safe to use with the parallelism preview? Parsing different HTTP response in two separate fibres using XML.parse_html and I'm getting invalid mem access exceptions. The issue only occurs with parallelism flag though, same code without the flag works fine.
<FromGitter>
<tenebrousedge> I would assume just about everything isn't thread-safe
<FromGitter>
<PercussiveElbow> Apologies if this is too tech support-y, loving the language :)
<FromGitter>
<PercussiveElbow> Yeah I had assumed that much already, but I (probably naively) thought it would be fine so long as the two fibres weren't reading/writing the same response variable
<FromGitter>
<tenebrousedge> I would naively think that as well
<FromGitter>
<tenebrousedge> but invalid mem access usually means that such things are not fine. But do you have an isolateable test case?
<FromGitter>
<Daniel-Worrall> I don't know if the http calls are thread safe so it could end up trying to look at the same response
<FromGitter>
<kingsleyh> I use Mint a lot - for all my projects - I love it