RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.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
aroaming_ has joined #crystal-lang
aroaminggeek has quit [Ping timeout: 240 seconds]
aroaminggeek has joined #crystal-lang
aroaming_ has quit [Ping timeout: 268 seconds]
<hightower4> How could I execute File.read(somefile) in the context of a macro?
aroaminggeek has quit [Ping timeout: 240 seconds]
<hightower4> Within {{ }}
aroaminggeek has joined #crystal-lang
aroaminggeek has quit [Ping timeout: 240 seconds]
jnyw has joined #crystal-lang
qard_ has joined #crystal-lang
qard_ has quit [Client Quit]
<FromGitter> <faultyserver> question for anyone who has deployed Crystal on heroku: have you experienced massive, somewhat-regular response time spikes?
<FromGitter> <faultyserver> I have a simple REST app that averages response times under 1ms, but at least twice a day it suddenly spikes to >50 seconds
<FromGitter> <faultyserver> All of my logs look normal, no big POST requests coming through or anything, memory usage is stable at around 6MB, dyno load is essentially 0
aroaminggeek has joined #crystal-lang
aroaminggeek has quit [Read error: Connection reset by peer]
aroaminggeek has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <faustinoaq> @faultyserver As far as I know heroku sleep their free instances, so these >50 seconds spikes are because heroku is waking up your instance
<jokke> is there a constant-time string comparison method in crystal?
<jokke> aha! Crypto::Subtle
<FromGitter> <faultyserver> I'm on a professional dyno, so it shouldn't be sleeping
<FromGitter> <faultyserver> afaict, it looks like heroku just killed the dyno manager I was on (or it had a problem. idk). The metrics dashboard now shows a grayed out section there, implying it was down entirely, not just slow
hightower4 has quit [Ping timeout: 240 seconds]
hightower has joined #crystal-lang
lacour has joined #crystal-lang
hightower has quit [Ping timeout: 268 seconds]
lacour has quit [Quit: Leaving]
aroaminggeek has quit [Quit: Textual IRC Client: www.textualapp.com]
rohitpaulk has joined #crystal-lang
<OceannBoy> What is the purpose of the "lib" dir when there is a "src" dir?
<FromGitter> <elorest> src is for your code. lib is for installed shards.
aroaminggeek has joined #crystal-lang
<FromGitter> <marksiemers> @faustinoaq - That article is from August ⏎ ⏎ > Tiobe did a great marketing here
<FromGitter> <marksiemers> It looks like Crystal dropped out of the top 50 in the most recent index
<FromGitter> <marksiemers> Which is a shame, hopefully it can jump back up in the coming months
OceannBoy has quit [Ping timeout: 260 seconds]
OceannBoy has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
<FromGitter> <faustinoaq> > It looks like Crystal dropped out of the top 50 in the most recent index ⏎ ⏎ @marksiemers Yeah, looks like Tiobe discovered that many "crystal programming" results in google weren't crystal at all but other things like crystal reports and esoteric stuff 😅
<FromGitter> <faustinoaq> We can reach Top 50 though 😉
<FromGitter> <marksiemers> I feel like it has been a good month
<FromGitter> <marksiemers> Crystal got over 10k stars
<FromGitter> <marksiemers> amber is on its way to 800
rohitpaulk has joined #crystal-lang
OceannBoy has quit [Ping timeout: 256 seconds]
aroaminggeek has left #crystal-lang ["Textual IRC Client: www.textualapp.com"]
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <watzon> Yeah it's an unfortunate reality that there is already software called Crystal Reports. Tends to interfere with search results for Crystal
<FromGitter> <watzon> Also those damn hippies and their energy crystals ;)
tilpner_ has joined #crystal-lang
tilpner_ has quit [Remote host closed the connection]
tilpner_ has joined #crystal-lang
<FromGitter> <aisrael> Hahaha… Crystal Reports has only been around since forever...
flaviodesousa has joined #crystal-lang
mark_66 has joined #crystal-lang
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
hightower has joined #crystal-lang
<FromGitter> <bararchy> what is the way to create http date format from `Time` ?
hightower3 has joined #crystal-lang
hightower has quit [Ping timeout: 240 seconds]
<FromGitter> <xfbs> Do we have support for doctests in crystal yet? (As in, testing code examples given in documentation)?
jnyw has quit [Quit: WeeChat 2.0.1]
frojnd has quit [Quit: running out of juice]
frojnd has joined #crystal-lang
<FromGitter> <xfbs> Also, how does one publish a shard?
rohitpaulk has quit [Remote host closed the connection]
<hightower3> xfbs: no publishing necessary, shard.yml present in the root dir is all you need (which you get when you run 'crystal init app|lib ...')
<hightower3> How can I check for existence of a variable? I am calling a macro which may create a variable as it expands, and after the macro I need to check if it exists or not
<edoput> hightower3: I'm not sure I understand this. Can you explain the use case?
<hightower3> edoput: I have a case where there is no way for me to pass arguments to certain point of code. But, all that code is basically a macro and gets expanded where I need it
<hightower3> But the code which is expanded in the macro looks something like:
<hightower3> var = MyObject.new
<hightower3> (among other things, of course)
<hightower3> So I want to do var = something myself (before calling the macro)
<hightower3> And then I want to modify the macro to expand to something like:
<hightower3> if var.exists? then ... something ... else var = MyObject.new end
<edoput> I don't think this can be done because of the nature of static typing. There is not such thing as a NoNameError because it won't compile
<edoput> but you can always prove me wrong :)
<FromGitter> <acoustep> Hi Guys, I'm new to Crystal and enjoying it so far :) ⏎ got a question which I can't seem to figure out. Copied this code from the Crystal openssl cipher spec file but I'm getting an error ⏎ `require "openssl/cipher" ⏎ ⏎ #... ... [https://gitter.im/crystal-lang/crystal?at=5a72f53f36de78850cd9086f]
<FromGitter> <acoustep> Sorry for the poor formatting, I'm new to Gitter too...
foxbot_ has joined #crystal-lang
mroth has quit [Ping timeout: 276 seconds]
foxbot has quit [Ping timeout: 276 seconds]
ilovezfs_ has quit [Ping timeout: 276 seconds]
dannyAAM has quit [Ping timeout: 276 seconds]
dannyAAM has joined #crystal-lang
mroth has joined #crystal-lang
brycek has quit [Ping timeout: 276 seconds]
<FromGitter> <bararchy> @acoustep most likely your openssl does not support this cipher, try another one (prefer no cbc)
swav has quit [Ping timeout: 276 seconds]
<FromGitter> <acoustep> Ok, thanks I'll give it a try
brycek has joined #crystal-lang
ilovezfs_ has joined #crystal-lang
davic has quit [Ping timeout: 260 seconds]
swav has joined #crystal-lang
davic has joined #crystal-lang
hightower has joined #crystal-lang
rohitpaulk has joined #crystal-lang
hightower2 has quit [Ping timeout: 240 seconds]
gewo has quit [Ping timeout: 240 seconds]
gewo has joined #crystal-lang
OceannBoy has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
instancer76 has joined #crystal-lang
<instancer76> whats faster (perfomance etc)? "@Constant = 10" or "@variable = 10" ?
<Papierkorb> Both are ivars.
<instancer76> ivars?
<Papierkorb> Weird question in any case. variables and constants are quite different use-cases.
<Papierkorb> @ivar
<instancer76> instance variables? yes i know, They will have both the same scope then. But what is taking longer to define?
<instancer76> or is it both the same? (speed)
<Papierkorb> your sample there has no constant. `@Constant` is no constant, it's a normal ivar.
<instancer76> ooh!
<Papierkorb> `CONSTANT = 10` would be constant.
<instancer76> so you cant define instance variable constants. allright thanks
<FromGitter> <straight-shoota> "instance variable constants" is a contradiction
<Papierkorb> straight-shoota, sounded to me like C's `const`
rohitpaulk has joined #crystal-lang
OceannBoy has quit [Ping timeout: 252 seconds]
<FromGitter> <yxhuvud> FWIW there is an open issue since a few years to implement those. I know asterite hasn't thrown it out yet
<FromGitter> <yxhuvud> it would be a nice way to get away from the silly `if foo = @foo` tests
kp666[m] has quit [Ping timeout: 248 seconds]
duane has joined #crystal-lang
kp666[m] has joined #crystal-lang
<instancer76> yes! i really hate these tests
tilpner has quit [Disconnected by services]
tilpner has joined #crystal-lang
tilpner_ has quit [Quit: :wq]
tilpner_ has joined #crystal-lang
tilpner has quit [Remote host closed the connection]
tilpner_ is now known as tilpner
sz0 has joined #crystal-lang
<jokke> anyone here using crecto? i have a transaction and need to get the id of one inserted record from the result. is this possible? result.inserts.last[:instance] <- this has id still set as nil
<jokke> instancer76: why?
<jokke> how else would you know if it's nil or not?
<jokke> instancer76: if you want to just hope things go well and crash at runtime you can define getter! :foo
<instancer76> its just really ugly for me. And also you need to put it around the whole code. You cannot use it in && or that you can do this: "return if !var = @var"
<hightower3> How would I go about using a macro to store complete contents of a particular file into a variable?
<RX14> if var = @var has never bothred me
<RX14> there's no way tog et rid of it
<RX14> so it's staying
<jokke> instancer76: what..? sure you can `var = @var || return` :P
<RX14> if you ""know"" it's never going to be nil then just use getter!
<RX14> and if it is going to be nil then you can't hate the pattern because it enforces you dealing with it
<RX14> plus the times where I have a nillable ivar which you know is not going to be nil is rare
<jokke> RX14: yup
<RX14> if `if var = @var` is bothering you, you likely need to just learn a few (i hate to say it) design patterns
<FromGitter> <yxhuvud> rx14: https://github.com/crystal-lang/crystal/issues/4359 would be one way to get rid of it in very many cases. (the suggestion in the issue cannot be implemented directly but perhaps some variation of it could be)
<jokke> straight-shoota: https://github.com/schovi/baked_file_system/pull/14 oh i missed this :P i'll try to take care of it in the near future
<RX14> I don't get how it changes anything?
<RX14> regarding types
<RX14> I don't get the utility
<RX14> it doesn't help here
<crystal-gh> [crystal] straight-shoota opened pull request #5667: Fix: string/symbol array literals recognize nested delimiters and escaped whitespace (master...jm/fix/percent-array-literal) https://git.io/vNFYV
<hightower3> jokke: so kool, thanks! ++
<RX14> @yxhuvud I don't understand my own comments in this issue, there's no way to get rid of `if var = @var`
<RX14> oh nvm i am wrong
<FromGitter> <yxhuvud> sure it is possible if the compiler would know that the variable is immutable once set
<RX14> I don't see the point though
<RX14> it's just so easy to do
<FromGitter> <yxhuvud> what isn't practical is changing *all* instance variables to being immutable. Having access to the choice would be really nice though.
<RX14> @Yxhuvud, *either way* you need to do `if @foo` or `return unless @foo`
<RX14> it's very little to change that to `if foo = @foo` or `return unless foo = @foo`
<RX14> it's such a small win for so much effort
<RX14> and I don't find it comes up often
instancer76 has quit [Quit: Page closed]
<FromGitter> <yxhuvud> except once for every new user of crystal. But yes, I guess people would run into it anyhow. immutable instance variables would be pretty nice though :)
<RX14> well new users won't know about immutable ivars either
<FromGitter> <straight-shoota> It's just something special with Crystal that you need to learn. And then it's really awesome once you get the whole picture of handling nil values
<FromGitter> <straight-shoota> jokke, what will you take care of?
<jokke> the pr
<FromGitter> <straight-shoota> oh, are you @jreinert ?
<FromGitter> <straight-shoota> didn't make the connection with the different handles
<hightower3> straight-shoota: I'm using baked_file_system and I have this line in the text file "subtext: Aqui está o seu cartão-presente!," and it causes baked_file_system to produce invalid code so compilation fails
duane has quit [Ping timeout: 248 seconds]
<FromGitter> <straight-shoota> What's the error message?
<hightower3> in src/file_system.cr:4: ^[[1mmacro didn't expand to a valid program, it expanded to:
<hightower3> And then a bunch of stuff, I'll try to isolate
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<hightower3> straight-shoota: ouch, it seems to be some weird issue. If I remove any line from file, it works even with the mentioned offending line in the input. But the file size is not the limit because I loaded some larger files without problems (these files are around 11 kB in size)
<hightower3> Hm I see it, so ^[[1mmacro didn't expand to a valid program, it expanded to:
<hightower3> and then:
<hightower3> Syntax error in expanded macro: load:795: unknown token: 'x'
<hightower3> slice: "\x1f\x8b\x08\x00\xec=s..... \xa5\xf8kx9q\x22\xbe\x05 ....
<hightower3> it appears as if it is complaining about this x9q which does not have \ in front
<hightower3> And this appears to be "...content...".to_slice call
<FromGitter> <straight-shoota> "unkown token x" looks like it's outside of a string literal
<FromGitter> <xfbs> I like the fact that rust tests the code in documentation comments so much that I hacked together a small script in ruby to extract code in doxygen comments from C/C++ projects and add those as unit tests 👍
<FromGitter> <straight-shoota> can you give me a reproducable sample?
<hightower3> @straight-shoota sent the link to your email, thanks!
rohitpaulk has quit [Ping timeout: 276 seconds]
<jokke> straight-shoota: yeah i am
<FromGitter> <straight-shoota> hightower3, it seems the baked string contains `{%` and crystal interprets that as an macro
qard has joined #crystal-lang
<FromGitter> <straight-shoota> so it's similar to the issue with interpolation (`#{`)
<hightower3> straight-shoota: but somehow the {% part gets mistakenly generated? The file I sent you does not have a literal {%, and as mentioned, if I delete *any* line from that file, then it works
<FromGitter> <straight-shoota> yeah, the contetn is gzip compressed
<hightower3> I assume there is no keyword in Crystal which instructs it to not look for macros in the protected block?
<FromGitter> <straight-shoota> probably not
<FromGitter> <straight-shoota> but the fix is easy
<FromGitter> <straight-shoota> like https://github.com/schovi/baked_file_system/pull/14
<hightower3> ok great, thanks
<FromGitter> <straight-shoota> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a7345606117191e61e09b1c]
<hightower3> straight-shoota: fabulous, works! thanks much
<FromGitter> <ShriekBob> @straight-shoota Hey, I didn't mean to ignore your comment on github by the way :) and if I kill my feature branch it's cool, honestly it was mostly just an impetus to push me to get crystal building on WSL :)
tankfeeder has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
coderobe has joined #crystal-lang
<coderobe> hello, is it possible to cast an Int64 to a UInt64? I know that the bounds are fine beforehand.
edoput has quit [Quit: ZNC 1.6.5+deb2+b2 - http://znc.in]
<FromGitter> <straight-shoota> sure, `5_i64.to_u64`
jxv has joined #crystal-lang
<coderobe> perfect, thanks
mark_66 has quit [Remote host closed the connection]
jxv has quit [Quit: zzz…]
jxv has joined #crystal-lang
codenoid has joined #crystal-lang
<FromGitter> <drosehn> In other languages, `a = b` is very often a sign that you've made a mistake, and that you really wanted `a == b`. So much so that compilers print a warning when they see `a = b`, and you have to do something to indicate that you really meant to do that. Usually you just have to throw an extra set of parenthesis around it.
<FromGitter> <ShriekBob> This is one of those random programming things I'll never quite understand. Why is = not the equality operator and something else the assignment operator. There you go though, we're kinda stuck with it now I think.
<codenoid> morning
<FromGitter> <drosehn> Well, we could go the old Algol way, and use `:=` for assignment and `=` for equality. 😄
<Vexatos> that's the way mathematics do it
rohitpaulk has joined #crystal-lang
<FromGitter> <straight-shoota> Well, I dont this this could reasonably changed
<FromGitter> <straight-shoota> besides it's efficient: how often do you have assignments in your code and how often comparisons for equality?
<FromGitter> <drosehn> Algol was around in the 1960's. The fact that so few languages have picked up on that probably shows that it's not a popular idea.
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <ShriekBob> I wouldn't expect it to change, and I think even if it did, both operators need to be single characters
<FromGitter> <drosehn> I think part of it is that `:=` is "uglier" than "=", while "==" is just a wider "=".
<Papierkorb> I have heard about this issue time and again, and never had it myself. Are so many peoples keyboards broken?
<FromGitter> <drosehn> Also, `:=` requires a shift for the `:`, which probably makes it less popular among programmers.
<Vexatos> the = requires a shift on my keyboard, too :P
<Papierkorb> well, [] and {} are popular too, and they're comparably tedious to type on non-US layouts
<FromGitter> <drosehn> Ick!
<Vexatos> [] and {} even require AltGr
<Papierkorb> Jokes on you, AltGr doesn't even exist on most US keyboards
<Vexatos> It does not exist on ANSI keyboards, no
<Vexatos> But the rest of the world uses ISO where it does exist
<Papierkorb> Yeah I wouldn't want to miss it
<FromGitter> <straight-shoota> => just need a unicode keyboard :D
<Vexatos> Also the better enter key :)
<Vexatos> I can type any unicode character rather quickly on this keyboard, which is nice because I use special characters a lot
<Vexatos> But a full unicode keyboard might be a bit big :)
<Papierkorb> Compose key to the rescue
<Vexatos> Papierkorb, Rather Ctrl+Shift+U
<Papierkorb> and kcharselect for anything else :P
<Vexatos> Ctrl+Shift+U is a blessing for anyone using obscure mathematical characters a lot, heh
<Vexatos> But I still wouldn't want to have to type characters like [ or = with it
<Papierkorb> If there's something I'd need a ton that's not accessible in the third key layer, nor through compose, I'd map it somewhere in those
<Vexatos> I have five layers configured right now
<Vexatos> The placement of {[]} and \ are the things that really make coding tedious, which is why I am looking into getting a UK keyboard next time, heh
<Papierkorb> I mean you can switch the layout through a key press
<Vexatos> I already do that while coding, heh
<Papierkorb> Though I'd look at neo if I ever feel like I need a different one
<Vexatos> That's why a standardized layout is nice
<crystal-gh> [crystal] straight-shoota opened pull request #5668: Fix String#dump for UTF-8 charachters > \uFFFF (master...jm/fix/string-dump-utf) https://git.io/vNF1L
alex`` has quit [Ping timeout: 256 seconds]
hightower3 has left #crystal-lang ["Leaving"]
hightower3 has joined #crystal-lang
moei has joined #crystal-lang
faustinoaq has joined #crystal-lang
alex`` has joined #crystal-lang
codenoid has quit [Quit: Leaving]
<faustinoaq> I'm using an `us` layout in a spanish keyboard, lol
jxv has quit [Quit: zzz…]
duane has joined #crystal-lang
tankfeeder has left #crystal-lang [#crystal-lang]
duane has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> Vexatos what do you mean by layers? Do you have a programmable keyboard with a tmk/qmk firmware or is it something else?
<Vexatos> Uh I think it's a feature in X11?
<Vexatos> You have one set of keys, a second one when you hold shift, a third when you hold AltGr, a fourth when you hold AltGr+Shift, and a fifth when you hold hyper/whateveryoucallit
<Vexatos> you can also do more with hyper+shift, etc
<FromGitter> <bew> Oh yeah ok
<Vexatos> In addition to that, I also have the compose key mapped, and unicode input mode on Ctrl+Shift+U so I can type all common chatacters quickly and any characters slowly :P
<Vexatos> characters*
<FromGitter> <bew> So you have custom layers?
<FromGitter> <bew> Looks nice the unicode input key idea
<Vexatos> I write a lot of chemical reports, so I commonly use characters you may or may not have ever seen before
<Vexatos> Unicode knows them, which is nice
<Vexatos> Technically, I can map any of these key combinations to any action, I just use them for typing characters
<crystal-gh> [crystal] asterite opened pull request #5670: Fix ASTNode#raise macro method (master...bug/5669-node-macro-raise) https://git.io/vNFNj
<FromGitter> <straight-shoota> jokke, just to let you know, I'm finishing an alternative PR to #14 which fixes a few additional issues as well
<FromGitter> <straight-shoota> schovi/baked_file_system#14
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<faustinoaq> Hi crystal community https://tfb-status.techempower.com/ here are raw result for latest TFB tests, RX14 What was the link to plot json result in TFB?
<faustinoaq> RX14 Thank you!
<jokke> faustinoaq: ah dang
<jokke> äh
<jokke> straight-shoota
qard has joined #crystal-lang
<jokke> just pushed :P
<FromGitter> <straight-shoota> sry, should have told you earlier
<FromGitter> <straight-shoota> I was hold up by #5668
<FromGitter> <imonmyown> hey guys, timezone everyone
<FromGitter> <imonmyown> how do I run a method on a possibly nil value?
<FromGitter> <imonmyown> I add an if clause but that doesn't seem to satisfy the compiler
<FromGitter> <asterite> is that value closured in a captured block?
<FromGitter> <asterite> you can also use `.try { |value| use(value) }`
<FromGitter> <asterite> also, the `if` only works for local var, maybe you are doing it with an instance var?
<FromGitter> <imonmyown> well, here's the code (https://gist.github.com/imonmyown/21b421daf09f9580531623daa2e00989)
<FromGitter> <imonmyown> yes, you're right, it's an ivar
<FromGitter> <asterite> you need to assign it to a local variable first... or use `try`
<FromGitter> <asterite> so, `@rhythmicity.try &.update(new)`
rohitpaulk has joined #crystal-lang
<hightower3> If I 'require' a shard but don't use anything from it, it is still compiled into the binary, right?
<FromGitter> <watzon> Ok I need some help. Do multiple threads automatically mean more memory is being used? I know Crystal doesn't have real multithreading yet, but say with Rust or C++
<FromGitter> <watzon> hightower3 I don't believe so
<FromGitter> <watzon> Only things you require are compiled
<hightower3> Yes, I said "if I require it"
<FromGitter> <imonmyown> @asterite yeah, that worked, thanks a bunch
<FromGitter> <watzon> Let me rephrase. If you don't use anything from it then I don't believe it gets compiled.
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <asterite> Right, only methods that you end up invoking get compiled
<hightower3> oooh, pretty awesome
watzon has joined #crystal-lang
jxv has joined #crystal-lang
<jokke> is there a is_a? for multiple types?
<jokke> as in is_one_of?(Foo | Bar | Baz)
<Papierkorb> is_a? should work with union types
<FromGitter> <straight-shoota> `is_a?(Foo | Bar | Baz)`
<jokke> oh ok nice
<jokke> can i restrict type in a case when?
<jokke> doesn't seem that way
<Papierkorb> watzon, a thread (by itself) should only/mainly require a few kernel resources to store it. On linux, that's comparable to what a process consumes, sans the memory required for the process image.
<Papierkorb> watzon, so .. I guess a few KiB or so. Nothing to worry about normally.
<crystal-gh> [crystal] straight-shoota opened pull request #5671: [WIP] Add specs for spec output (master...jm/feature/spec-output-spec) https://git.io/vNbql
<Papierkorb> watzon, the process itself only really holds the handle, so that's just a few Bytes at best. After that, your process could of course consume resources per thread or something :)
<Papierkorb> *the handle to the thread
<watzon> Thanks man. That's pretty much what I thought, but I'm in an argument with an idiot who seems to thing that multithreading uses drastically more RAM
<Papierkorb> "Depends on how the application uses them"
<watzon> Right, but that's more related to the way you're using memory in the first place
<watzon> Not the multithreading aspect
<Papierkorb> Dunno what Windows does, I'd guess it's comparable. Lin & Win will look drastically different when you think about processes instead of threads though
<Papierkorb> I always thought it's interesting how threads are mainly implemented in user-space in linux (or were?). Shows how powerful of a paradigm the UNIX principles are
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <bew> Is it? *need to look that up*
<Papierkorb> all you need is clone(2)
<Papierkorb> where you pass a flag to tell if you want to share your memory space or not. A "real" thread also sets some other flags iirc, but that's the gist
<Papierkorb> wait you could also use it to put threads into different filesystem roots.
<Papierkorb> Yeah that's not going to confuse anything ever
<FromGitter> <bew> Cool thanks for the hint, what's a "real" thread then?
<Papierkorb> "real" as in, some more flags may be set or unset compared to fork
<Papierkorb> > If CLONE_PID is set, the child process is created with the same process ID as the calling process. This is good for hacking the system, but otherwise of not much use.
<Papierkorb> Great idea
<FromGitter> <bew> Is fork a syscall or a wrapper around clone with many flags?
<FromGitter> <bew> Lol that's fun
<Papierkorb> There seems to be a fork syscall still (for compat), but people say glibc is using clone() under the hood. So "it depends"..?
jnyw has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <bew> Neat
<Papierkorb> You can wade (Ctrl+F) through /usr/include/bits/syscall.h and /usr/include/asm-generic/unistd.h for the system call numbers to find all. Indeed, there's a native fork syscall
<Papierkorb> If you always wondered, if every API always gets it right on the first try, there's your answer to that too lul
<Papierkorb> True story, go actually "parses" (Read: Uses a whacko perl script) these files to figure out the system call numbers.
<FromGitter> <bew> Argh ˆˆ
jxv has quit [Quit: zzz…]
duane has joined #crystal-lang
jxv has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
qard has joined #crystal-lang
qard has quit [Client Quit]
cremes has quit [Quit: cremes]
p0p0pr37 has joined #crystal-lang
qard has joined #crystal-lang
cremes has joined #crystal-lang