ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.22.0 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
Raimondi has quit [Write error: Broken pipe]
Raimondi has joined #crystal-lang
havenwood has quit [Quit: mIRC 5.91 (16 bit) for Microsoft © Windows For WorkGroups 3.11®]
havenwood has joined #crystal-lang
havenwood has quit [Changing host]
havenwood has joined #crystal-lang
havenwood has quit [Read error: Connection reset by peer]
havenwood has joined #crystal-lang
DissonantGuile has quit [Quit: WeeChat 1.7.1]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Aytan72 has joined #crystal-lang
Aytan72 has quit [Ping timeout: 260 seconds]
_whitelogger has joined #crystal-lang
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
Aytan72 has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Aytan72 has quit [Ping timeout: 246 seconds]
bjz has joined #crystal-lang
yogg-saron has joined #crystal-lang
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yogg-saron has joined #crystal-lang
mounibec has joined #crystal-lang
mounibec has quit [Client Quit]
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qchmqs has joined #crystal-lang
Aytan72 has joined #crystal-lang
mick75 has joined #crystal-lang
Aytan72 has quit [Ping timeout: 245 seconds]
mick75 has quit [Quit: Page closed]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
mounibec has joined #crystal-lang
<FromGitter> <bew> There's no `Char.new`?!
<FromGitter> <bew> How can I check if a buffer of `UInt8` is (or starts with) a valid `Char`?
<oprypin> bew, it seems like you're conflating several concepts here, so i ask for a more detailed explanation. do you assume UTF-8 or what?
<oprypin> bew, https://crystal-lang.org/api/0.22.0/IO.html#read_char%3AChar%3F-instance-method
<FromGitter> <bew> Thanks @oprypin, I can't assume anything about the input, it can be simple ascii chars or utf-8 chars or control characters..
<oprypin> bew, well you have to either assume or guess, except guessing is not really a thing
<FromGitter> <bew> Can a utf-8 char be invalid? (eg. missing a byte) or will it result in another char?
<FromGitter> <bew> (another valid)
<oprypin> at any point in the stream you know whether you've just finished a character or waiting for more bytes
<oprypin> it's like a prefix code, if that tells you anything
<FromGitter> <bew> I guess I'll need to guess the format, and if nothing match, try utf-8
<FromGitter> <bew> Yeah I see
<FromGitter> <bew> There is no `IO#read_char?` or `IO#read_valid_char!`, assuming utf-8, how to know if the io has a valid (complete) utf-8, or only a partial char?
<oprypin> bew, i think the method i linked woudl do it
qchmqs has quit [Read error: Connection reset by peer]
<FromGitter> <bew> Ok I got it, setting the io's encoding to raise on invalid char will do it, thanks for tips @oprypin :+1:
<oprypin> bew, this has many interesting snippets: https://github.com/crystal-lang/crystal/search?q=InvalidByteSequenceError
<FromGitter> <bew> Perfect
mounibec has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yogg-saron has joined #crystal-lang
<wuehlmaus> a = [] of (Int32,String); a << 2 ; a << "Bob" ; b = a[1].chars doesn't work. bug? at least it does not seem too obvious.
<wuehlmaus> oh sorry, a = [] of (Int32|String) i meant
yogg-saron has quit [Client Quit]
<oprypin> wuehlmaus, not a bug, and it is in fact obvious and well documented.
<Yxhuvud> wuelhlmaus: integers don't answer to chars, so why do you expect it to work?
<oprypin> a[1] has a compile-time type of (Int32|String). Int32 does not have a .chars method, so it is invalid to call it on that
<Yxhuvud> You probably want a Tuple instead if you have predictable indices.
<wuehlmaus> well, if a[1] is a string, i thought it could work
<Yxhuvud> No, crystal enforces this in compile time, not runtime. Hence it can't work
<wuehlmaus> ah, thanks Yxhuvud
<wuehlmaus> of course i know that chars doesn't work on an Int32 :)
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mounibec has joined #crystal-lang
splitty___ has joined #crystal-lang
splitty__ has quit [Ping timeout: 252 seconds]
Qchmqs__ has joined #crystal-lang
Qchmqs__ is now known as Qchmqs
mounibec has quit [Quit: Textual IRC Client: www.textualapp.com]
bjz has joined #crystal-lang
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
Aytan72 has joined #crystal-lang
Aytan72 has quit [Ping timeout: 245 seconds]
<crystal-gh> [crystal] meew0 opened pull request #4349: Add a simple method to run a block every X seconds (master...feature/every) https://git.io/v9CR6
zipR4ND has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 258 seconds]
zipR4ND has quit [Ping timeout: 255 seconds]
Aytan72 has joined #crystal-lang
Aytan72 has quit [Ping timeout: 260 seconds]
zipR4ND has joined #crystal-lang
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 240 seconds]
zipR4ND has quit [Ping timeout: 246 seconds]
pta2002 has joined #crystal-lang
Qchmqs has quit [Ping timeout: 240 seconds]
<FromGitter> <codingphasedotcom> hey guys
<FromGitter> <elthariel> yo
<pta2002> hi
<FromGitter> <MatthewBennington> hi
<pta2002> (sorry for probably dumb question) How do I have a C string as argument on a binding?
<FromGitter> <elthariel> fun strlen(Int8*) : Int32
<pta2002> e.g. the function i want to bind takes in const char*, what do I put on the crystal side
<FromGitter> <MatthewBennington> I believe it would be `LibC::Char*`
<FromGitter> <elthariel> ^^^ Looks actually better
<pta2002> hm okay
<pta2002> I'll try that
<FromGitter> <MatthewBennington> Yeah, either would work
<pta2002> yep, that worked, thanks!
* FromGitter * elthariel updates the sysctl bindings he's writing haha :)
<FromGitter> <elthariel> thanks @MatthewBennington
<FromGitter> <MatthewBennington> @elthariel No problem!
<FromGitter> <codingphasedotcom> Hey I want to make my project to be able to be pulled from shards package manager any tips on how to properly do it
<FromGitter> <MatthewBennington> Someone correct me if I'm wrong, but doesn't shards just clone from github?
<oprypin> codingphasedotcom, this is an overly verbose guide http://veelenga.com/make-your-own-shard-in-crystal-language/
<pta2002> oprypin: TIL crystal init is a thing
<oprypin> i never use it
<FromGitter> <codingphasedotcom> https://github.com/codingphasedotcom/rocky
<pta2002> why?
<oprypin> codingphasedotcom, short story is, you should have a file like this https://github.com/crystal-lang/shards#usage and put it on github
<oprypin> pta2002, i dont like starting with cruft
<pta2002> i see
<FromGitter> <codingphasedotcom> the thing is that its not just crystal code theres also javascript packages
<FromGitter> <codingphasedotcom> I might endup using yeoman
<oprypin> oh my what is even going on here
<oprypin> (no need to answer)
<oprypin> i mean, shards does put the whole folder available somewhere so there's a chance that it'll just work , put probably not. i dont know
<FromGitter> <codingphasedotcom> yea
<FromGitter> <codingphasedotcom> my project is more of a stack than a shard
<FromGitter> <codingphasedotcom> so its react over crystal kemal and yarn
<FromGitter> <codingphasedotcom> and what I want to do is some how make it easier for developers to just have all the tools one project
<FromGitter> <codingphasedotcom> but I'm adding new features and libraries to the project everyday and I want a way that it make it easier for people to download the latest version when they starting a new project
<oprypin> shards is not designed to handle non-crystal dependencies
<FromGitter> <codingphasedotcom> ok cool
<FromGitter> <codingphasedotcom> I will take a look at how the mean stack does it
<FromGitter> <codingphasedotcom> thanks
unshadow has quit [Ping timeout: 240 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
unshadow has joined #crystal-lang
<pta2002> i don't have much experience with shards, but maybe you can have an npm package.json and have npm install run on clone?
unshadow has quit [Client Quit]
<oprypin> its possible to run custom command on shards install
<FromGitter> <bew> crystal?
<FromGitter> <Sija> yep
<FromGitter> <bew> niice!!
<FromGitter> <Sija> today is the day it seems :)
<FromGitter> <MatthewBennington> I haven't stared the repo yet
<FromGitter> <bew> :+1:
<FromGitter> <tekjar> Is no. of public events directly proportional to rate of increase of stars? :P
<FromGitter> <MatthewBennington> I think I'm number 8000
<oprypin> yay
<FromGitter> <Sija> congrats!
<FromGitter> <Sija> next stop 8080
<FromGitter> <Sija> proxy star number
<pta2002> 8000 stars, nice! :D
<crystal-gh> [crystal] oprypin opened pull request #4351: Fail the Travis check as soon as one of the jobs fails (master...patch-3) https://git.io/v9CP1
<Papierkorb> 8086 would also be kinda neat :P
<crystal-gh> [crystal] elthariel opened pull request #4352: [RFC] Add Sysctl interface support for OSX/Linux/FreeBSD (master...feature/sysctl) https://git.io/v9CPx
<Papierkorb> with an accompanying Crystaldisk operating system
<pta2002> alright this is probably very dumb
<pta2002> but how do you do explicit type interference on variable declaration
<pta2002> outside of classes or function arguments
<FromGitter> <MatthewBennington> `foo : string`, I believe
<pta2002> what I'm trying right now is var : Type = value
<pta2002> but that doesn't seem to be working
<pta2002> e.g. for c : UInt32 = 3, 'type must be UInt32, not Int32'
<FromGitter> <Sija> it’s about the casting
<FromGitter> <Sija> u need to use `Int32#to_u`
<pta2002> what do you mean?
<pta2002> ooh
<FromGitter> <Sija> `c : UInt32 = 3.to_u`
<FromGitter> <MatthewBennington> or `c = 3_u32`
<FromGitter> <Sija> yep
<FromGitter> <Sija> even better since it’s compile time instead of runtime
<oprypin> with llvm that line is probably blurred in this case
<FromGitter> <MatthewBennington> I'm not sure you can declare a type explicitly and define a variable at the same time, but I could be wrong.
<oprypin> you kinda can
<FromGitter> <MatthewBennington> kinda?
<oprypin> but it's (almost?) never useful
<pta2002> i have a use!
<pta2002> which is what i'm trying to get working
<pta2002> say I have a lib
<oprypin> nope, that's different
<pta2002> oh
<oprypin> you were putting an Int32 literal and trying to assign it to a UInt32 type
<oprypin> so you just want an UInt32 literal
<oprypin> anyhow.. `a = 5.as(Int32 | Int64)`
<pta2002> yeah I thought it'd turn the number into an UInt32
<pta2002> either way, if I have a type on a lib
<pta2002> say, type Ui32 = UInt32 (this is useless i know), I can't seem to get a constant to be that type?
<oprypin> pta2002, `type` and `alias` have different uses. mainly, `type` creates a new type that acts just likethat one but is different for the purposes of type checks
<pta2002> yeah I know
<pta2002> so how do I create a constant of that type?
<oprypin> ASDF = 5u32.as(Lib::Ui32)
<oprypin> should work ... but why?
<pta2002> oooh
<pta2002> oprypin: flags
<oprypin> i'm not entirely sure if my code will work, it might even be impossible
<oprypin> pta2002, that's @[Flags] enum
<pta2002> and now that I think of it, I should probably be using an enum for this
<pta2002> yep
<oprypin> see, no actual use for this :|
<pta2002> thanks anyways
<pta2002> oprypin: it actually can't cast it
<pta2002> the enum works though so I'll use that
<oprypin> then i think there is no sane way to create these values
<oprypin> like `pointerof(that).as(Lib::Ui32*).value`
Aytan72 has joined #crystal-lang
Aytan72 has quit [Ping timeout: 258 seconds]
<FromGitter> <Sija> @RX14 https://github.com/crystal-lang/crystal/pull/4352/files#r114060070 - what do u mean by referring to #4237?
<RX14> @Sija oh...
<RX14> I didn't think about lib_c
<RX14> I just read about extracting it to multiple files
<RX14> and anywhere apart from lib_c using macro skip would be the best way to implement that
<FromGitter> <Sija> yeah, but that’s IMO another issue
<RX14> hmm?
<FromGitter> <Sija> you’d still want to extract it into its own file?
<FromGitter> <Sija> aside of using `skip()` macro i mean
<RX14> you'd extract it into multiple files
<RX14> one for each architecture
<RX14> and use `skip unless flag(:bsd)` or the like
<RX14> but thats unnecesary due to the way lib_c works
<RX14> lib_c should really just be using macros imho
<RX14> not the weird load path stuff
_whitelogger has joined #crystal-lang
<FromGitter> <KCreate> Hey, if I pass a Union to a method, is there a way to make the compiler generate different versions of the method for each type in the union?
<FromGitter> <KCreate> Example: https://carc.in/#/r/1y8f/edit
<FromGitter> <KCreate> Currently I get `(Int32 | String):Class`, but I need `Int32` or `String`
<Papierkorb> KCreate, typeof is the compile-time type
<FromGitter> <KCreate> yes
<Papierkorb> KCreate, if you want the runtime type, use`.class` instead
<FromGitter> <KCreate> I need different methods for each type inside the union
<Papierkorb> There will be
<Papierkorb> if the compiler notices it needs them
<FromGitter> <KCreate> The actual method I have: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5904f246cfec919272897c39]
<FromGitter> <KCreate> But I'm getting `(Float64 | Int64 | String):Class`
<FromGitter> <KCreate> which in turn creates a slice of wrong size
<pta2002> what causes the "unterminated call" error?
<oprypin> pta2002, you tell us
<pta2002> oprypin: alright
<oprypin> i mean paste the code or something
<FromGitter> <KCreate> @pta2002 maybe related to https://github.com/crystal-lang/crystal/issues/337
<pta2002> i'm trying to bind sdl
<oprypin> unclosed brackets, i guess?
<pta2002> oprypin: hm i don't think so
<pta2002> but i'll paste
<oprypin> pta2002, uhh why bind sdl for the 5th time?
<pta2002> LibSDL.fill_rect(surface, nil, LibSDL.map_rgb(surface.value.format*, 0xFF, 0xFF, 0xFF))
<pta2002> this is the line
<pta2002> oprypin: learning really
<FromGitter> <Sija> `surface.value.format*` ?
<oprypin> `*` is certainly out of place
<pta2002> ah
<pta2002> but if I remove the *
<pta2002> it tells me
<pta2002> it must be Pointer(LibSDL::PixelFormat), not LibSDL::PixelFormat
<oprypin> pointerof(z) is the syntax
<Papierkorb> KCreate, create a untyped method which just does `pointerof(data).as(UInt8*).to_slice(sizeof(typeof(data)))`
<pta2002> oh
<pta2002> so what is the difference between pointerof and *?
<oprypin> * is not valid syntax basically
<Papierkorb> KCreate, shameless plug: maybe what you need is implemented in the `cannon` shard already
<oprypin> it's only valid as a shortcut in type grammar
<pta2002> ah
<pta2002> got it
<pta2002> "can't take address of surface.value.format"
<pta2002> when i do LibSDL.fill_rect(surface, nil, LibSDL.map_rgb(pointerof(surface.value.format), 0xFF, 0xFF, 0xFF))
<oprypin> yep because .format is copied by value which is a temporary thing so you cant get the pointer of it
<pta2002> hm
<pta2002> so how do I pass it in?
<oprypin> it's hard to know what the right thing because it's sensitive to context. and i really hope i never have to learn sdl
<FromGitter> <KCreate> @PapierKorb Thanks for that! Cannon looks really look but might be a might overkill since I only need to serialize primitive types
<Papierkorb> pta2002: store the result of surface.value.format in a temporary variable, and then take a pointerof(that_thing)
<pta2002> let me trythat Papierkorb
vikaton has joined #crystal-lang
<pta2002> invalid memory access
<pta2002> is this like a segfault?
<oprypin> ya
<pta2002> huh
<pta2002> what casued it?
<Papierkorb> look at the stacktrace underneath it if any
<oprypin> any small mistake in what you did would cause that
<Papierkorb> pta2002: Don't use _prefixed variables in normal code. The underscore indicates "not used" to the reader
<pta2002> oh
<pta2002> fixed that
<FromGitter> <KCreate> @Papierkorb What do you mean by not used? Is `_` somewhat special in crystal?
<pta2002> KCrate: from what I understand it's just a convention
<pta2002> just like you usually put constants ALL CAPS in C, you add an underscore as a prefix to tell it's not used
<Papierkorb> KCreate, don't remember if it was really special to the compiler. However, saying `def foo(_bar)` means that foo takes an argument, but you don't use it.
<FromGitter> <Sija> @KCreate such convention exists in Ruby-land too
<Papierkorb> Exactly the same, even
<oprypin> i have no idea why it segfaults
<oprypin> the code makes sense, just some mistake i can't see
<pta2002> could it be a problem with sdl?
<Papierkorb> Could be, the faulting address is pretty large
<pta2002> isn't the address essentially random though
<oprypin> what do you mean by problem with sdl... it's like 0.0000000001% probability
<pta2002> yeah it's VERY likely it's me
<Papierkorb> oprypin: passing broken stuff will break in sdl
<oprypin> ah, well sure, it does seem like SDL is doing the memory access
<Papierkorb> pta2002: random? Yes, but only to an extent. The address space is split into regions, and in these regions will be some somewhat (or actually) random address
<oprypin> but that's not exactly what we (at least I) meant
<pta2002> "NOTE: You MUST recompile Crystal without the native SDL bindings, otherwise segfaults will occur. Simply remove the SDL files from a fresh clone of the Crystal source code and compiling should be enough."
<pta2002> There's native SDL bindings on crystal?
<oprypin> pta2002, i wouldn't look at 3 year old code for crystal
<pta2002> didn't see that
<pta2002> but yeah you're right
<Papierkorb> pta2002: Recheck your structures first, then the methods, then comment out most of your code and iteratively uncomment code again
<pta2002> wee debugging
<pta2002> is there a debugger?
<oprypin> pta2002, i don't think that's a viable approach
<Papierkorb> gdb
<pta2002> oprypin: what isn't a viable approach?
<oprypin> are you sure the logic of your code would hold up even if you ran the equivalent in C?
<oprypin> using a debugger, but that's just in my closed-minded experience
<pta2002> ah
<pta2002> *shrug*
<oprypin> like maybe you're just not initializing some member
<pta2002> found the problem
<pta2002> missing thing on PixelFormat
<Papierkorb> yay for rechecking struct's
<pta2002> that was not it
<pta2002> the names don't have to match the ones on the library right?
<oprypin> pta2002, don't have to
<pta2002> alright
<pta2002> because SDL uses captials on the first letter
<pta2002> and i changed them to lowercase
<oprypin> only `fun` names matter
<oprypin> (of course you can adapt them like you're doing, that's fine)
<pta2002> cool
<pta2002> C's int is Int32 right?
<oprypin> pta2002, if you run out of ideas i really recommend duplicating the example in C and checking if it works
<Papierkorb> pta2002: Yes, but there's also LibC::Int
<oprypin> pta2002, it is on all platforms currently supported by crystal. see^
<pta2002> oprypin: http://lazyfoo.net/tutorials/SDL/01_hello_SDL/index2.php it's pretty much this
<Papierkorb> Same for other types, like LibC::Short or LibC::ULongLong
<pta2002> hm alright
<oprypin> screenSurface->format is not a pointer in that example
<oprypin> you needing pointerof() should have made you wary
<FromGitter> <KCreate> @Papierkorb your snippet isn't working (`typeof(data)`) still returns the union type
<oprypin> pta2002, SDL_PixelFormat* format
<oprypin> you do not have it as a pointer in your struct
<FromGitter> <KCreate> usually `typeof(data.class)` would give me the runtime type but that's not working either (gives me: `(Float64:Class | Int64:Class | String:Class)`)
<oprypin> gotta pay extreme attention to this
<pta2002> oprypin: ooo thanks!
<oprypin> and like i said if rewriting the example directly gave you an error, you should not blindly look for a workaround to make it compile, but instead think why the difference is there
<pta2002> that also fixes the previous pointer thing
<pta2002> yeah, i should pay more attention to these things
<Papierkorb> KCreate, Fixing that isn't fun. Not sure right now, but you'd have to write a macro which checks if the type is an Union, and if yes, builts a `case` statement checking for each type and returning each types size
<oprypin> pointerof(a) is &a in C syntax, which is not done in the original example
<Papierkorb> KCreate, I'm guessing, maybe it's not even possible that way
<pta2002> wooo white screen! :D
<pta2002> oprypin: i'll take note of these stuff
<pta2002> thanks for the help :)
<oprypin> pta2002, btw if you wanna get right to writing games with a good lib, that would be https://github.com/oprypin/crsfml (shameless plug)
<pta2002> oprypin: i think i've actually seen that
<pta2002> or at least I saw some crystal sfml bindings
<pta2002> how does binding to C++ classes work?
<oprypin> pta2002, it doesn't :|
<Papierkorb> well technically... hehe
<pta2002> huh
<pta2002> how did you get sfml working then?
<FromGitter> <Sija> @KCreate It seems to me that you’re trying to get a runtime value (return type from `num`) at compile time
<oprypin> pta2002, by also making C bindings to SFML
<pta2002> I mean, doesn't sfml heavily use classes?
<FromGitter> <KCreate> @Suja What i need is a slice with the bytes of a given value
<FromGitter> <KCreate> And the type of that value is a union
<pta2002> oprypin: don't we have the same problem again though?
<Papierkorb> KCreate, what do you need it for?
<Papierkorb> KCreate, implementing an already existing, binary protocol?
<oprypin> pta2002, well no, there is no problem anymore, Crystal has C functions to bind to and nothing else
<oprypin> i have every class passed as void* so uh yeah
<pta2002> yeah but how does C bind to the classes?
<Papierkorb> pta2002: C++ code can emit C style functions
<FromGitter> <KCreate> I'm writing an assembler for my virtual machine, which needs to be able to encode various types
<pta2002> oh didn't know that
<pta2002> well, didn't know you could do that this way
<FromGitter> <KCreate> I guess a simple case statement for all the types would suffice but maybe there's an easier built-in way
<pta2002> I see how it works oprypin
<Papierkorb> pta2002: the magic is `extern "C" { .. }`
<pta2002> you just made a wrapper around it right?
<oprypin> yes, "just" :p
<pta2002> what does extern "C" do?
<pta2002> i've seen it quite a lot but i have no idea what it is
<Papierkorb> pta2002: Tells the C++ compiler that it must not mangle the names of the functions inside the block, but emit them as written
<pta2002> ah
<pta2002> so, for libraries?
<oprypin> i actually don't have extern C anywhere :o
<Papierkorb> When interfacing to C
<pta2002> to make it bindable
<Papierkorb> If you're interfacing to C++, you can just use C++ normally
<oprypin> ah no, I do have it everywhere. #define VOIDCSFML_API extern "C" __declspec(dllexport) void
<pta2002> that makes more sense
<pta2002> well I'll see if I can get input working
<pta2002> although I think I achieved my goal of figuring out how bindings work
<oprypin> well you can never run out of edge cases when porting these. but you got the general idea anyway
<RX14> oprypin, thanks so much for that PEP
<oprypin> :> these are a goldmine
<RX14> so was the go proposal for monotonic Time
<pta2002> ... okay I don't have the patience to bind all the sdl event structs
<pta2002> I got it mostly working
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
zipR4ND has joined #crystal-lang
<FromGitter> <fridgerator> if a struct has a property that is an array, is it safe to create a new instance of the struct then push values to the array after initialization?
<pta2002> @fridgerator I think that'd only really be safe if you have a pointer
<FromGitter> <fridgerator> alright, i'll have to use a class then
<RX14> uhh
<RX14> the array is a pointer
<RX14> whether using an Array in a struct or class, array itself is always a class
<Papierkorb> fridgerator, that's safe. the array is basically a smart slice as class
<RX14> and therefore always a pointer
<FromGitter> <fridgerator> oh rly?
<pta2002> ah didn't know that
<Papierkorb> Yup, check `src/array.cr`
<Papierkorb> Array is probably one of the least magic built in classes in Crystal
<Papierkorb> Hash is also pretty non-magical
<RX14> yeah array is a class which holds pointer, size and a few more bits
<RX14> the most magic built-in is probably string
<RX14> which uses wizardry
<FromGitter> <fridgerator> lol
<RX14> Strings are a normal class but they access the string content by assuming that it's directly after the class in memory
<Papierkorb> String is indeed really special. Try to find where its instance variables are defined :P
<RX14> yeah well do the same for array Papierkorb
<Papierkorb> RX14: Array can be understood without
<RX14> but it is defined in program.cr
<Papierkorb> String threw me off at first, Array not so much
<RX14> sure
<RX14> actually yeah
<RX14> Array doesn't have instance vars defined
<RX14> also why is css so confusing, one minute flex-grow does nothing now it does something
<FromGitter> <fridgerator> flex is confusing
<pta2002> Papierkorb: but then someone else comes in and the room turns red
<RX14> hah
<pta2002> but only for them
<RX14> if flexbox is confusing, the rest of CSS is just magic
<Papierkorb> pta2002: And then comes in the IE user, and there's not even a room for them
<RX14> flexbox I can somewhat predict
<RX14> the rest of CSS layout has been built up by browser behaviour with little spec
pta2002 has quit [Quit: WeeChat 1.7.1]
ssvb has quit [Quit: Leaving]
A124 has quit [Ping timeout: 240 seconds]
A124 has joined #crystal-lang
vikaton has quit [Quit: Connection closed for inactivity]
chatter29 has joined #crystal-lang
chatter29 has quit [Client Quit]
<FromGitter> <KCreate> @Papierkorb btw, this is what I've ended up using: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59051d1ed32c6f2f0952e849]
Aytan72 has joined #crystal-lang
Aytan72 has quit [Ping timeout: 246 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]