<oprypin>
well anyway me and @j8r came to the same solution without an action or token
<FromGitter>
<Blacksmoke16> not one way to solve a problem
zorp has joined #crystal-lang
zorp has quit [Ping timeout: 256 seconds]
Vexatoast has quit [Quit: ZNC Quit]
Vexatos has joined #crystal-lang
hightower2 has quit [Ping timeout: 265 seconds]
<FromGitter>
<UnsolvedCypher_gitlab> I'm getting an `invalid cross-device link` error when attempting to use File.rename. Is there a method that supports moving files regardless of location? FileUtils.mv is an alias of this method and has the same result
<FromGitter>
<Blacksmoke16> Uhh
<FromGitter>
<Blacksmoke16> What os, version etc?
<FromGitter>
<UnsolvedCypher_gitlab> I'm on Linux (ArchLinux specifically but I'm not sure if that matters)
<FromGitter>
<Blacksmoke16> workaround, try doing a copy/delete
<FromGitter>
<UnsolvedCypher_gitlab> Kernel is 5.6.11-arch1-1, Crystal is 0.34.0
<FromGitter>
<UnsolvedCypher_gitlab> Yes, copy/delete does work so I'll do that in the meantime :)
<FromGitter>
<UnsolvedCypher_gitlab> If this is not intended behavior, I can open an issue
<FromGitter>
<UnsolvedCypher_gitlab> Hmm that seems to imply that this wasn't happening before
<FromGitter>
<Blacksmoke16> dunno
rocx has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #crystal-lang
<FromGitter>
<spTorin> How turn on autoformat in VSCode with extension `faustinoaq.crystal-lang`?
<raz>
you mean "format as you type"? hmm
<raz>
(not sure about that, i always just hit alt+shift+f)
_ht has joined #crystal-lang
<FromGitter>
<spTorin> Just want run `crystal tool format` on key or on-save.
<oprypin>
@spTorin: it should work, but does formatting work at all?
<FromGitter>
<bew> @UnsolvedCypher_gitlab this is how linux's `mv` does it as well, there is no other way when the files goes from one drive to the other. Maybe the stdlib's function could hide this, but I'd say it's also important to know what's really going on when you try to do this!
alexherbo2 has quit [Ping timeout: 256 seconds]
<FromGitter>
<spTorin> @oprypin `crystal tool format file.cr` worked well. But I can't find how use it in VSCode.
<oprypin>
spTorin, well there's mandatory configuration in the extension to set the path to crystal executable
<oprypin>
which system is this anyway
alexherbo2 has joined #crystal-lang
zorp has joined #crystal-lang
<FromGitter>
<j8r> oprypin: useful, thanks. TIL git worktree
<FromGitter>
<j8r> Why do you want to keep the history of a gh-pages branch?
<oprypin>
j8r, you know, i also wonder about why i want to keep the history of 1MB search-index.json files
<oprypin>
the real answer is that keeping the history is the default option we should be striving for
<FromGitter>
<j8r> documentation is automatically generated
<FromGitter>
<j8r> I don't say it is not useful to keep the documentation history, but only if we can still access to it (like for the crystal compiler)
<oprypin>
unfortunately on Windows there's no happy accident with the shell, and that one was really annoying to work with. something doesnt work randomly and all you get is `Error executing process: No such file or directory`
rocx has joined #crystal-lang
<raz>
hm, well who runs carc.in? they might wanna know ;)
<oprypin>
raz, know what? there's no problem here. it's jhass running it, anyway
<raz>
ah ok, i though arbitrary exec wasn't supposed to be allowed
<raz>
n/m, it also works without your wrapper. i had thought that was the whole point of the pastie lol
<oprypin>
raz, the wrapper is IRC-bot-specific, i didnt do it
<raz>
ahh ok
<oprypin>
all it does is add `p!` to the last expression
<raz>
well i think the crystal exception basically wraps the errno label (see `errno -l`)
<raz>
it could also include the arguments that were tried to be more helpful, but not sure if that could raise potential security/privacy issues (stuff leaking into logs etc.)
<oprypin>
🤔
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo2 has joined #crystal-lang
<yxhuvud>
raz: I note that loom is implementing at least some of their async using io_uring (on linux). That is pretty nity.
<yxhuvud>
*nifty
<raz>
yep, i wasn't entirely serious with that above remark of course. ;) it looks pretty cool and is prob a bit more advanced than what crystal does atm. (just wanted to applaud that crystal is def on a good track with its concurrency model :+1:)
<FromGitter>
<UnsolvedCypher_gitlab> @bew I understand that that is how it works under the hood, but I still think it would be helpful to have a function to do this since most high-level programs probably don't care where the files are located and just want to get it from one place to the other
<FromGitter>
<bew> true, I saw your issue afterward, we'll see where it's going!
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 265 seconds]
alexherbo2 has quit [Ping timeout: 246 seconds]
<raz>
UnsolvedCypher_gitlab: might be your chance to enter the crystal hall of fame with a PR :)
alexherbo2 has joined #crystal-lang
<raz>
hum, still struggling with basic typedefs :/
<raz>
jhass: hmm good point. guess i'm trying to be a bit more generic than i should (altho it would be awfully convenient if the above just worked). it's complicated to explain :/ - basically the data travels through json and i'm trying sub-keys to various places that know what they allow and i'm trying to codify that knowledge only there, otherwise i'd bleed into all kinds of places.
<raz>
oh well, i'll fiddle around some more ;)
deavmi has quit [Quit: Eish! Load shedding.]
<raz>
naqvis: hmmm!
<FromGitter>
<naqvis> 😆
<FromGitter>
<naqvis> you just need to be explicit
<raz>
ha, that might actually work
<jhass>
you say it would leak to various places, I say defining a full model is actually a benefit and makes your code clearer than opaque hashes that you don't really know what they contain anymore at some point
deavmi has joined #crystal-lang
<FromGitter>
<naqvis> totally agree with jhass comments
<FromGitter>
<naqvis> but jhass, there are sometime use-cases where one might need to write a generic ADT
<FromGitter>
<naqvis> like `Any` used in stdlib
<jhass>
then use Any :)
<FromGitter>
<naqvis> language is providing the `Union` type, so there might be use-cases for the same
<jhass>
don't make your own subset type just because
<jhass>
your serialization choice is the upper bound of possible types, handle them
<FromGitter>
<naqvis> agree
<raz>
in principle you are of course right. in practice... oh well, these rare cases exist where you can only anticipate the structure of the data but not all types/keys that may appear (e.g. when the data is generated by other systems).
<FromGitter>
<naqvis> then question would, why compiler isn't able to infer the type in this scenario?
<FromGitter>
<naqvis> value type is indeed one of the Union type
<jhass>
say a = "foo"; b = "foo".as(String|Int32). Can you see a and b having different memory layouts?
<FromGitter>
<Blacksmoke16> my guess would be `.as` can only *reduce* the types, not add types to it?
<FromGitter>
<naqvis> they do and definitely do
<jhass>
so, you also see Hash(String, String) and Hash(String, String|Int32) having different memory layouts?
<jhass>
doesn't it make sense that you can not insert a String|Int32 into something with memory layout for String?
<jhass>
but that's what you're asking Crystal to allow with that cast
<FromGitter>
<naqvis> hmmm
<FromGitter>
<naqvis> is crystal union concept different than C one?
<FromGitter>
<naqvis> now i start doubting my understanding of UnionType concept in Crystal
<jhass>
I'm not sure I'm intimately familar enough with either one confidently answer this, but I think it's very similar. Crystal unions just always have a tag for the runtime value that's in the union
<jhass>
so String|Int32; is something like struct { int tag; union { char* string; int number } value }
<jhass>
don't nail me on the order of the struct fields
<FromGitter>
<naqvis> can you please help to shed some light on the rationale behind having this UnionType addition to language?
<jhass>
I think initially it was just a smart solution to having a type annotation free but statically typed language
<FromGitter>
<naqvis> make sense
<jhass>
and I think it still avoids a lot of boilerplate
<jhass>
and just generalizes the solution to having a null type
<jhass>
that is making String and String? different types
<jhass>
btw unions between reference types and nil are just represented as the pointer in memory, the nil value is represented as a null pointer
<jhass>
neat little optimization
deavmi has quit [Quit: Eish! Load shedding.]
<jhass>
I mean how would you do a map or list type supporting mixed types in their values? Either you force the user to use the most general common type (Object) or you have them declare a union type explicitly
<jhass>
* in other languages I wanted to say
deavmi has joined #crystal-lang
<FromGitter>
<naqvis> personally i prefer to go via interfaces other than concrete types
<FromGitter>
<naqvis> yeah i understand the benefit, but the cost is also not little in Union types
<FromGitter>
<naqvis> as one need to do switch to understand what he/she is dealing with
<jhass>
wasn't much of an issue for me, but then I come from dynamically typed languages :)
<FromGitter>
<naqvis> thanks lol
<jhass>
I think union types are actually the one thing that transport the haptics of dynamically typed languages best to the statically typed world
<jhass>
for me
<FromGitter>
<naqvis> agree
<FromGitter>
<naqvis> thanks jhass and it was a great session for me
<jhass>
<3
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<FromGitter>
<rishavs> Dumb question time, but in the issue https://github.com/crystal-lang/crystal/issues/6957 about adding event loop to Windows, why are we not considering using libuv, instead of working directly with IOCP? maybe even remove libevent from crystal in favor of libuv altogether? Libuv is cross plat and even .nets kestrel server uses it. ⏎ I think i might be missing something very obvious