ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.1 | Fund Crystal's development: | GH: | Docs: | API: | Gitter:
<Papierkorb> cc oprypin
<Papierkorb> I'm so tired I even put a typo in the commit title. great.
hightower3 has joined #crystal-lang
<FromGitter> <bew> Papierkorb the configuration file of bindgen looks really nice πŸ‘ πŸ‘ ;)
hightower4 has quit [Ping timeout: 248 seconds]
<RX14> bindgen looks like one of the most useful and high-quality projects i've seen for crystal
<Papierkorb> :)
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
DTZUZO has quit [Ping timeout: 240 seconds]
mooe_ has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
_whitelogger has joined #crystal-lang
claudiuinberlin has quit [Quit: Textual IRC Client:]
rohitpaulk has joined #crystal-lang
DTZUZO has joined #crystal-lang
_whitelogger has joined #crystal-lang
DTZUZO has quit [Ping timeout: 240 seconds]
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <monouser7dig> > it is not possible to choose ? ⏎ ⏎ you can have a pointer to some resource thus the pointer gets past by value but the resource is a reference, like if you'd really really need to
<FromGitter> <imonmyown> Morning!
_whitelogger has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
_whitelogger has joined #crystal-lang
Philpax has joined #crystal-lang
<FromGitter> <ekremkaraca> Morning guys
rohitpaulk has quit [Ping timeout: 255 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <imonmyown> Guys, would anyone care to mentor not a complete noob on a small project (and perhaps further on)?
<watzon> imonmyown: What kind of project? Feel free to ask all the questions you need
<watzon> Oh and hi everyone :) It's been a while
<FromGitter> <imonmyown> @watzon I want to implement a touch typing tutor, perhaps, I should PM you?
<FromGitter> <imonmyown> Would be easy if you were on gitter :)
rohitpaulk has quit [Ping timeout: 248 seconds]
<Papierkorb> Morning
<watzon> I have gitter, but prefer irc. Anyway, I a touch typing tutor sounds like quite a project and something I doubt I'd have time for
<watzon> But feel free to ask questions here. This community is pretty active
<FromGitter> <imonmyown> Oh, ok
<FromGitter> <bararchy> Morning all :)
rohitpaulk has joined #crystal-lang
<FromGitter> <imonmyown> The code ( is pretty sloppy, I didn't get to polishing yet. The foundation was derived from CrSFML typing example, just added random text generation so far
<FromGitter> <imonmyown> I will mark my question with \[Typing Tutor\] tag further on
<FromGitter> <imonmyown> Would be grateful for suggestions on further work and improvements. As the next step I plan on adding character distribution change based on the delays of the input characters
Philpax has quit [Read error: Connection reset by peer]
unshadow has joined #crystal-lang
<oprypin> imonmyown, nice to see it being useful. though usually you write a comment where you copied code from :p
ShalokShalom has joined #crystal-lang
ShalokShalom_ has quit [Ping timeout: 248 seconds]
<FromGitter> <imonmyown> @oprypin, oh, sorry about that man, will fix that :)
<FromGitter> <imonmyown> I was thinking about a rewrite of most of the functionality, so it didn't occur to me. Sorry again!
<FromGitter> <monouser7dig> morning πŸ˜„ , is there a way of issuing a bash command like rubys 'system' but ideally also getting back the response?
<FromGitter> <bararchy> @monouser7dig
<FromGitter> <monouser7dig> out that looks very good, what is this %x?
<FromGitter> <imonmyown> this ( also works
<FromGitter> <bararchy> @imonmyown but you can't juse it in a var
<FromGitter> <bararchy> it will just return true\false
<oprypin> monouser7dig, the hacky way is: a = \`ls\` , the proper way is
<FromGitter> <bararchy> Supreme version :) ⏎
<FromGitter> <monouser7dig> in that case what IO would I set as the output to get it back into the program?
<FromGitter> <bararchy> @monouser7dig look at my example
<FromGitter> <monouser7dig> beat me πŸ˜„ just in time, thanks
<FromGitter> <bararchy> keep in mind the size of IO::Memory
<FromGitter> <bararchy> as in expected output size
<FromGitter> <monouser7dig> how does %x handle this? (I do not plane to go insane though so it's probably fine)
<FromGitter> <bararchy> %x will return both STDERR and STDOUT back to the var
<FromGitter> <bararchy> AFAIK
<FromGitter> <bararchy> need to test it though :)
<oprypin> what the hell is %x
<FromGitter> <bararchy> same as system() but returns output and error back instead of true\false
<FromGitter> <bararchy> :)
<FromGitter> <bararchy> it's from Ruby
<FromGitter> <monouser7dig> I once had two C programs, one was outputting some letters and it was | piped into another which was reading them, and I was also wondering how this even worked in terms of buffer cause the consumer program was definitely slower than the producer, but it worked
<oprypin> these % things are the ugliest garbage
<FromGitter> <bararchy> I agree :) it's just left overs from Ruby
<FromGitter> <bararchy> like $1
<FromGitter> <bararchy> etc..
<FromGitter> <monouser7dig> πŸ˜„ lol, it's just hard to read if one is not used to, the ruby people enjoy it for creating arrays afaik
<FromGitter> <bararchy> all are inturn leftovers frmo perl
<oprypin> %x is not documented or used anywhere, so there's that
<FromGitter> <monouser7dig> but I like its output, please keep something like that πŸ˜„ it is actually nice and easy
<oprypin> monouser7dig, instead of %q() use ``
<oprypin> monouser7dig, instead of %x() use ``
<livcd> unrelated to crystal...but anyone follows truffleruby ?
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter> <imonmyown> @livcd who's that?
<FromGitter> <imonmyown> I see it mentiones Rubinius at the bottom, used to look forward to it...
<FromGitter> <monouser7dig> yeah will do so ⏎ ⏎ I think there was something about truffle or graal that was more proprietary than usual?
<livcd> uh i honestly do not care if smh is proprietary :)
<Papierkorb> Looked pretty OSS to me
<livcd> though Oracle being behind it
<livcd> it's a bit meh
<FromGitter> <monouser7dig> looking at it again seems pretty normal but I had in mind it was closed + paid
<Papierkorb> Yeah they'll try to milk it if it ever takes off
<livcd> nothing wrong with milking it
<livcd> but oracle is known for screwing up with axing staff and closing projects because they do not sell to fortune100
<Papierkorb> that's milking to me
<Papierkorb> Just like they tried with OpenOffice
<Papierkorb> Just like they tried with MySQL
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb> Look how well those went
<livcd> Papierkorb: ah ok
<FromGitter> <monouser7dig> in some video the manas devs left a sentence on running crystal on the JVM and it was like, it's not a really big problem in itself to get that running for some if statements but mainly all libraries just won't work
<Papierkorb> That'd be switching out the LLVM backend with a JVM one
<livcd> for me screwing up would be making it too expensive / unaffordable and losing momentum if it ever takes off
<livcd> i still cant wrap my head around how did they kill solaris and the entire ecosystem
<FromGitter> <imonmyown> @livcd I believe they screwed up too many things to be trusted again
<livcd> imonmyown: is there a corporation / medium sized company you trust ? :)
<Papierkorb> RedHat is doing good stuff
<FromGitter> <monouser7dig> > **<Papierkorb>** That'd be switching out the LLVM backend with a JVM one ⏎ ⏎ ⏎ you mean that one? []
<RX14> well i trust oracle, it's just that i trust them to do the worst possible thing
<livcd> Papierkorb: you mean that red hat that refuses to support you if you run centos along rhel in one DC ?
<FromGitter> <imonmyown> I feel it's okay while it's a medium sized company, but once it goes corporate, it's doomed to turn into pile of shit
<Papierkorb> monouser7dig, how you do it doesn't matter. Also, JVM, as in: Uses way too many resources and start time is abysmal. So "nah"
<RX14> the jvm isn't bad
<Papierkorb> "But the JVM uses memory!" Yeah as does my kernel, thanks a lot
<RX14> but if you simply replaced llvm with the jvm for crystal
<RX14> you'd get none of it's benefits
<RX14> except maybe a better debugger
<RX14> and java interop
<RX14> but who cares
<FromGitter> <bararchy> JIT ?
<Papierkorb> The benefit being?
<RX14> LLVM isn't even half the compile time unless --release
<RX14> so theres no point
<FromGitter> <bararchy> I'm not for it, just naming Java fetures :)
<RX14> naming java features doesn't really mean anything...
<FromGitter> <bararchy> also, would not like to be jailed to "can run on anything which already has java installed"
<RX14> once LLVM becomes the bottleneck then maybe JIT would be worth looking into for compile times
<RX14> but it's currently not really one
<RX14> the complexity needs to be reduced in the typecheck and codegen
<RX14> and once we reduce the number of instantiations, LLVM compile times will reduce a lot too
<RX14> since it has less work to do
<FromGitter> <bararchy> can crystl have JIT ? from my understanding JIT works only for programs running in a VM (ruby, python, java, etc..)
<RX14> LLVM has a JIT
<RX14> which is a LVM for interpreting it's IR
<RX14> VM*
<RX14> and JIT
<RX14> like all jits it has an interpreter and a compiler part
<RX14> the JIT is actually used in the compiler specs
<RX14> to speed up some of the compiler tests
<RX14> it just breaks when you require the prelude
<FromGitter> <bararchy> Oh, didn;t know that, will it means if used, that crystal will only run where LLVM is installed ?
<RX14> yes
<RX14> because it'd run inside the compiler process
<RX14> well
<RX14> maybe after a fork
<FromGitter> <monouser7dig> ⏎ ⏎ > LLVM IR is able to be used for various targets, but the IR itself is not portable. When it is generated, it has hard coded assumptions about the architecture, the OS, and the libraries that it will be used with. ⏎ ⏎ so JIT would bring no improvements cause the type inference effort is spend in both cases
<FromGitter> <imonmyown> @bararchy didn't get what you were trying to say about true/false:
<FromGitter> <monouser7dig> var ⏎ true
<FromGitter> <monouser7dig> the list of files is because system outputs to...the terminal?, in any case your variable does not hold that data, if you remove the print, everything works the same, except the true is missing
<FromGitter> <imonmyown> @monouser7dig not very clear what you're trying to say
<FromGitter> <monouser7dig>
<FromGitter> <imonmyown> Oh, ok, I think I got it
ShalokShalom_ has joined #crystal-lang
<FromGitter> <imonmyown> thanks for clarification
ShalokShalom has quit [Ping timeout: 240 seconds]
<FromGitter> <bararchy> the return value fo system is true\false in regards to if the command executed or not
<FromGitter> <imonmyown> thanks man
<FromGitter> <monouser7dig> it is actually the return code of the command, it may return false even if it executes, but fails πŸ˜„ in lack of crystal docks
<FromGitter> <monouser7dig>
<FromGitter> <ekremkaraca> There
<FromGitter> <ekremkaraca> Nowadays there is a huge interest from πŸ‡°πŸ‡­
<FromGitter> <bararchy> what's that for ?
<FromGitter> <ekremkaraca> To my sbs Crystal series on YouTube
<FromGitter> <bararchy> Oh cool
<FromGitter> <bararchy> cambodia ha ?
<FromGitter> <bararchy> XD
<FromGitter> <ekremkaraca> About 60%
<FromGitter> <ekremkaraca> But no one from πŸ‡ΉπŸ‡· :(
<FromGitter> <ekremkaraca> Oh, there is already sbs Crystal series in Turkish
<FromGitter> <monouser7dig> this arch user is not by chance in here behind an acronym? πŸ˜„
<FromGitter> <monouser7dig> hm does not seem so
<oprypin> yeah who is this speaking?
<oprypin> t-richards
<FromGitter> <monouser7dig> "how do you know someone uses arch?" he tells you πŸ˜„
<FromGitter> <ekremkaraca> Here are sbs from Turkish channel
<FromGitter> <ekremkaraca> But there's "unknown region" ?
<FromGitter> <ekremkaraca> Probably Northern Cyprus
ShalokShalom_ is now known as ShalokShalom
<Papierkorb> Huh `crystal tool implementations` doesn't support `-`, nor `/dev/stdin` nor a fd path
<Papierkorb> Always "file does not exist"
<Papierkorb> I mean, the latter two look like files to me
<FromGitter> <monouser7dig> how does regex work to extract a match? I used ⏎ ⏎ ```match = /\w+/.match(some_string) ⏎ ⏎ branch = match.try &.to_a[0]``` ⏎ ⏎ but I don't think this is the right way []
go|dfish has quit [Quit: SIGQUIT]
<Groogy> is there a nice method on enumerables that lets me test a block on every element? i.e if all of them are true it returns true?
<Groogy> need to convert this invariant from C++ INVARIANT(std::all_of(self.myTiles.begin(), self.myTiles.end(), [&self](const TileData& tile) { return tile.typeIndex >= 0 && tile.typeIndex < self.myTileTypes.size(); }))
<FromGitter> <monouser7dig> .each_with_object, a bool and ||= ?
<Groogy> oh duh there's an all?
<Groogy> I somehow missed it as I was scrolling past, probably since it was first
<oprypin> monouser7dig, `if some_string =~ /(\w+)/; use $1`
<Papierkorb> `if m = /(\w+)/.match("foo bar")` and use m[1]
<Papierkorb> Death to pseudo globals
<oprypin> Papierkorb, im checking out Windows compatibility for but this is a really weird failure, Windows not even involved
<Papierkorb> Just got the mail
<Papierkorb> .. Interesting regression. Will have a look in a few mins
<FromGitter> <monouser7dig> m.try &.[1] works, m[0] surprisingly as well (both give foo)
<oprypin> Papierkorb, it seems to reproduce even on older commits! must be something about my local setup
<Papierkorb> Nope I get that issue as well
<Papierkorb> At least both in the wrapper and in the virtual trampoline
<oprypin> ok then maybe it's a change in cuz i only bisected on bindgen
<Papierkorb> Ah well, time to add -Wall -Werror to the Makefile to catch crap like this
<Papierkorb> The integration tests already do that anyway
<Papierkorb> Ah I think I know what happens
<Papierkorb> hint hint, a type is void even if it's a pointer type
<oprypin> ofc
A124 has quit [Quit: '']
<vegai> so what's def hash(hasher) for?
<vegai> it seems to me that I'm able to hash my created structs without providing this
<vegai> related to akzhan's last comment on
rohitpaulk has joined #crystal-lang
<oprypin> vegai, you should write `def hash(hasher)` in all your objects and use that. then there is a Object#hash without args that calls that one
<oprypin> if you override `def hash` you are bypassing some nice algorithmic advantages also security
<oprypin> vegai, all that akzhan is saying is that you have not implemented a hashing method on your type
<vegai> so what is it using? I'm able to make a hash with BigDecimal keys already
<vegai> or is this something else
<FromGitter> <monouser7dig> that is a nice catch πŸ˜„
<oprypin> vegai, hm that's true, the default hash implementation might actually work
<oprypin> though ideally you must ensure this invariant: `if a==b then a.hash==b.hash`
<oprypin> looking at the equality method, that is NOT currently ensured because it is possible for two bigdecimals with diferent bytes in them to be equal
<vegai> might there be a default hasher that does to_s or something?
<vegai> ah, I see
<oprypin> default hasher on Struct just combines .hash of all member variables
<oprypin> it may be a very difficult task to ensure that but it's really important
<vegai> yes
<Papierkorb> oprypin: Update both bindgen &, fixed it for me
<oprypin> thx will try soon
<vegai> oprypin: thank you
<vegai> seems to me like a simple correct hasher would be one that first does to_s and hashes from that
<vegai> even if not very performant
<Papierkorb> ... no?
<vegai> why not?
<Papierkorb> #to_s is in no way guaranteed to be a stable, unambigous machine-readable string
<oprypin> well vegai knows better what this type's to_s does
<oprypin> i think it's acceptable
<Papierkorb> What about `def_equals_and_hash`
<oprypin> Papierkorb, that's just selecting which members to use individually.
<oprypin> Papierkorb, look at `def ==` in
<FromGitter> <monouser7dig> stripping trainling zeroes?
<vegai> Papierkorb: BigDecimal's equals needs to be a bit more complex than just comparing a few fields
<vegai> that's whan def_equals allows, right?
<oprypin> certainly. i think Papierkorb was just speaking about the typical case, not this particular case
<Papierkorb> ^
<vegai> ah right, sorry
unshadow has quit [Remote host closed the connection]
dahhowl has joined #crystal-lang
<Papierkorb> faustinoaq, is the wildcard change already live?
<FromGitter> <zyriuse75> i read a file and i would want to grep on it to find a params but i dont find the params on the API who can help me :(
<oprypin> zyriuse75, please give a better explanation and example
pduncan has joined #crystal-lang
<FromGitter> <zyriuse75> yep sorry @oprypin
<oprypin> zyriuse75, are you sure you dont want to just use bash?
<FromGitter> <bararchy> array.includes?("centos") ?
<FromGitter> <zyriuse75> yeah
<oprypin> zyriuse75,
<oprypin> actually why strip, just do ``` p `. /etc/os-release && printf "%s" "$ID"` ```
<FromGitter> <zyriuse75> thank @oprypin is much better :)
pduncan has quit [Ping timeout: 246 seconds]
rohitpaulk has quit [Ping timeout: 255 seconds]
<oprypin> Papierkorb, hm i dunno how to proceed with those linking errors.
<Papierkorb> Are all sources compiled by the same compiler?
<oprypin> Papierkorb, qt is precompiled by the compiler that's part of the path, you can see it
<oprypin> i'm using "Visual C++ 2015 x86 Native Build Tools Command Prompt"
<oprypin> so hopefully same compiler
<Papierkorb> Not sure, but there may have been one or two mandatory defines for windows
<Papierkorb> For Qt
<oprypin> nvm actually using Visual C++ 2015 x64 Native Build Tools Command Prompt
<Papierkorb> Do you have qmake around?
<oprypin> Papierkorb, yeah it's got to be in one of those folders
<Papierkorb> create a new project with `qmake -project`, add `gui widgets` to the QT variable in the .pro file (if not already in there), then `qmake`, and see the Makefile (or w/e) it created
<Papierkorb> Try adding these defines to the c++ generator build step: `-DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED`
<Papierkorb> Dunno if these are required on windows
<Papierkorb> oprypin:
<oprypin> wait, what am I supposed to see in the makefile?
snsei has joined #crystal-lang
<Papierkorb> I always thought Makefiles are awful. But that may be some form of Art right there.
<Papierkorb> Can you add a main.cpp?
<Papierkorb> If that Makefile still isn't helpful, `make` it. Let's see how it does it
<oprypin> updated but whatever
<oprypin> problem is i don't have `make` on windows
<Papierkorb> As long you see the compiler invocation, you can also use whatever. QMake can produce MSVC projects files iirc
alex`` has joined #crystal-lang
<oprypin> yep that's some nice defines right there. thanks!
rohitpaulk has joined #crystal-lang
<Papierkorb> Also looking to rework's If someone wants to untoshify it, let me know
<oprypin> i copied ALL the flags and it did something
<oprypin> i.e. produced .obj file without error
snsei has quit [Remote host closed the connection]
<Groogy> mipmaps ruining my beutiful landscape :(
<FromGitter> <monouser7dig> impressive πŸ˜„
<Papierkorb> Remindes me of Mode7 games
<FromGitter> <monouser7dig> the fact that it compiled πŸ˜„
<Groogy> gonna cook then gonna add height differences
<Groogy> the gray area is supposed to be heightened (being a mountain and all)
snsei has joined #crystal-lang
<FromGitter> <l1meon> Hi all. Trying to use qt5 crystal but receiving this error installing shards ⏎
<Papierkorb> You're missing the boehmgc development files
<oprypin> libgc-dev
DTZUZO has joined #crystal-lang
<FromGitter> <l1meon> oprypin, thx that worked, now I've got other error: ⏎
<Papierkorb> You also require the Qt development files..
<oprypin> just assuming ubuntu lol
<Yxhuvud> Groogy: Is it supposed to look liek that?
<Groogy> nah
<Groogy> I am working on the code where the tiles will look around themselves to figure out how they shoud look
snsei has quit [Remote host closed the connection]
<Groogy> i.e "I am a cliff, I should have a wall" and "I am a ramp, I should have a slope to this other higher tile"
<oprypin> nice
<Groogy> will have to add tools later in Boleite though so you can manipulate mipmaps, right now that is what is causing those weird pixels
DTZUZU has quit [Ping timeout: 246 seconds]
<Groogy> since @sdogruyol can't see imgur :)
<Groogy> special link for you
DTZUZU has joined #crystal-lang
<FromGitter> <bararchy> That's cool
<FromGitter> <bararchy> Nice work :)
<Papierkorb> Mh should I add a default maping from `const char *` to String in bindgen?
<Groogy> no, since a lot of libs use it as a "any kind of data" sort of pointer
<Papierkorb> Yeah that's what I'm thinking too
<Groogy> i.e it should really be void*^but they don't
<Groogy> and a String is 4 bytes per character
<Groogy> while char* is only one
<Papierkorb> Huh it's UTF-8
<Groogy> isn't char 4 bytes big?
<Papierkorb> Anyway, don't worry, bindgen does all those conversions :P
<Groogy> in Crystal
<Papierkorb> Yes Char is, but String isn't Char*, it's based on UInt8*
<RX14> Groogy, you seem to misunderstand what utf-8 is
<Groogy> ah okay nvm then
<RX14> is a variable length encoding for 4-byte unicode codepoints
<RX14> char is an expanded codepoint
<Groogy> I know what it is
<RX14> string encodes those codepoints as utf-8
<Groogy> I just assumed because of other languages that String used Char
<Groogy> internally
<Groogy> becuase I am dumb
<Papierkorb> Now, what happens when I bind the whole fucking glibc?
<oprypin> error
<Papierkorb> Except for those functions taking a function pointer .. and varargs
<Groogy> oh also there's an interesting problem and wonder how bindgen would solve it
<Papierkorb> ?
<Groogy> soooo glVertexAttribPointer have an interesting argument
<Groogy> the last argument is a void* but it is supposed to be used as a number
<Papierkorb> I'll try to bind ioctl() and its #defines though. That always annoyed me not having.
<Papierkorb> You're f'd. Though I was thinking about class- and method local type configuration
<Papierkorb> Because of such insanity
<Groogy> but I think it also supportes pointers?
<Groogy> i.e it is the offset to the data
<Groogy> and any normal human being specifies an interval
<Papierkorb> Groogy: Though what I'd actually do is provide a method of the same name manually in Crystal, which calls its sister function, doing a Pointer(Void).new(the_int_value) as conversion
<Groogy> yeah and I do that right now directly
<Papierkorb> Which is probably the most sane solution to it. That locality feature would be for insane APIs where this is not easily possible from Crystal alone.
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
sz0 has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<oprypin> Papierkorb, agh i have no idea what i'm doing, appears i have moved the linking error from that stage of compilation to the final stage.
<oprypin> Papierkorb, anyway, here are some things i had to change
<Papierkorb> Are you linking to the correct libs?
<oprypin> some errors and warnings are below
<oprypin> Papierkorb, how would i know
<Papierkorb> ... Just copy the arguments qmake uses to link the program into the library: lul
<oprypin> oh sure i tried that
<Papierkorb> Can you paste me the whole qt.yml and config/* files you modified?
<FromGitter> <sdogruyol> awesome, thank you @Groogy πŸ‘
<oprypin> Papierkorb, why?
<Papierkorb> To see the whole picture
<Papierkorb> I see correctly you didn't change the ext/Makefile?
<oprypin> it's totally useless on windows
<Papierkorb> Oh, could you move the qt_binding.lib in front of all Qt*.lib's in the compilation step?
<Papierkorb> No idea if that's an issue on Windows
<Papierkorb> And probably before libstdc++ too
<oprypin> i tried both ways.
claudiuinberlin has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Quit: Ping timeout (120 seconds)]
rohitpaulk has joined #crystal-lang
<oprypin> what i find strange: never specifies any libs
<Papierkorb> Not required if not linking
<oprypin> Papierkorb, but it has to be linking against qt libs somehow
<oprypin> or is that the point, i'm not supposed to link against qt libs
<Papierkorb> It does in the next line, where it calls `link`
<Papierkorb> It should
<oprypin> Papierkorb, oh i was referring more to the link line where i dont see any qt libraries
<Papierkorb> Never used MSVC
<oprypin> oh the principles are the same
<Papierkorb> Can't you try and modify that Makefile to link the cross-compiled crystal program instead of the Qt program
go|dfish has joined #crystal-lang
<FromGitter> <l1meon> oprypin, regarding the qt5 error that I'm receiving, I've installed all the dev packages and libs from the link you gave: ⏎ But the error still persists. What else can be the problem?
<oprypin> l1meon, you're not supposed to install all. anyway, please show the error
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <l1meon> I'm on Ubuntu 17.10 if its important.
<oprypin> Papierkorb, yep that's a problem. no /usr/include/qt on ubuntu
<oprypin> l1meon, you need -I/usr/include/qt5 in
<oprypin> not /usr/include/qt
<FromGitter> <l1meon> /usr/include/x86_64-linux-gnu/qt5/QtCore
<FromGitter> <l1meon> like this?
<oprypin> oh damn
<Papierkorb> Oh it's missing an optional $QTDIR expansion
<Papierkorb> Though if qmake is in the path, iirc you can simply -query it to tell you
<oprypin> Papierkorb, well the fix is probably on you, but i dont even know a workaround
<Papierkorb> It's an oversight, it should've tried $QTDIR
<Papierkorb> l1meon, You can generate the binding by setting the `QTDIR` environment variable to the installation path of Qt5. That won't fix compilation though. For that, in this moment, you'll have to patch ext/Makefile, line 1, the -I, to the correct path
<FromGitter> <l1meon> Papierkorb, ok, I'll change the line 1. Thx
<FromGitter> <alex-lairan> Hi, I have compiled Crystal on local to use different LLVM version, but when I compile hello world, I get ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Someone have an idea? :) []
<FromGitter> <alex-lairan> With the `apt` version, no problems
<oprypin> alex-lairan, tried installing libpcre-dev and libgc-dev?
<FromGitter> <alex-lairan> Okay, thanks, after install all missing libraries everything works :)
<FromGitter> <alex-lairan> Why apt version works?
<FromGitter> <l1meon> Papierkorb, what libraries and dev need for clang?
<Papierkorb> On Ubuntu? No idea. Probably everything that looks like `clang-dev`
<FromGitter> <l1meon> running this: ⏎ lib/bindgen/ qt.yml ⏎ ⏎ produces this: ⏎ []
<FromGitter> <l1meon> the thing is that there are no clang-dev ..
<FromGitter> <l1meon> I just looked
<Papierkorb> `find -name CommonOptionsParser.h /usr/include` does it find anything?
<FromGitter> <l1meon> nope
<Papierkorb> try install libclang-dev
<FromGitter> <l1meon> installed
<Papierkorb> Yep that'll install necessary files. Which aren't found, because the paths are different again. Great.
<oprypin> l1meon, maybe u can skip that and use pre-generated files
<Papierkorb> ^
<Papierkorb> It's high time I update those anyway
<FromGitter> <l1meon> oprypin, I'll try
<Papierkorb> l1meon, have your ext/Makefile modification handy, you'll need to apply it again
<Papierkorb> Updated the pre-generated branch
<FromGitter> <l1meon> Papierkorb, ok
<oprypin> Papierkorb, how do you feel about the fact that qt has different APIs on different platforms and compilers?
<Papierkorb> The urge to punch a wall
<oprypin> Papierkorb, no std::chrono-based APIs on MSVC, an extra abstract method (!) on Windows
<Papierkorb> platforms is simple enough, just generate it on the target platform. But I can't fake a MSVC in clang
<Papierkorb> Lol no chrono? What year is it?
<Papierkorb> oprypin: Platform specific configuration is a solved issue
<oprypin> cool
<Papierkorb> `if_os_is_windows: ...`
<Papierkorb> As far bindgen configuration is concerned
<Papierkorb> And missing stuff like chrono could be easily emulated for the user with some custom code
<Papierkorb> in Qt
<oprypin> yeah but you actually can't generate a Windows-only abstract method, can you
<Papierkorb> Why not? If you generate on windows?
<oprypin> sure then
<oprypin> but how do you then solve "just works"
<Papierkorb> With some platform detection logic to choose the correctly pre-generated sources
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
<FromGitter> <HCLarsen> @faustinoaq that's some great info, thanks.
claudiuinberlin has joined #crystal-lang
<FromGitter> <zyriuse75> i would want to check if the script running is by root or not . i try to use without sucess :( do you have an idea how i can do that ?
<FromGitter> <georgeu2000> Does Crystal typically use symbols for keys like Ruby?
<Papierkorb> You use classes much more often than random hashes as compared to ruby
<Papierkorb> At least I barely use hashes (only if really required). I can still count the times I used a symbol. There's barely a need
<FromGitter> <monouser7dig> if you want to use a string as key, then use a symbol cause it's not going to be modified and is smaller but apart from that...depends I'd say
<Papierkorb> Erm .. a string can't be modified either in Crystal
<Papierkorb> The distinction made when to use a string vs symbol is the same as in ruby. it's just that crystal code prefers different paradigms to ruby code
<FromGitter> <georgeu2000> In this use case, I think I may want a "random hash"...
<FromGitter> <georgeu2000> But I see why Structs are better.
<FromGitter> <monouser7dig> lol, hadn't even looked at it cause I took it for granted
<FromGitter> <monouser7dig> still a symbol would be smaller
<Papierkorb> georgeu2000, do you come from a ruby background?
<FromGitter> <georgeu2000> Yes.
<FromGitter> <georgeu2000> That's all I know...
<FromGitter> <georgeu2000> Hence all the stupid questions...
<Papierkorb> Then as I said, the decision when to use string vs symbol is the same in Crystal as in Ruby :)
<FromGitter> <georgeu2000> Got it. Thanks.
<FromGitter> <georgeu2000> The use case is parsing the response from the JSON API in the specs. I guess the question is, do the specs know about the Structure of the JSON response...
<FromGitter> <georgeu2000> And they maybe they can use the Struct...
<Papierkorb> spec is short for specification. You can't specify what you don't know
<Papierkorb> They absolutely can
<FromGitter> <monouser7dig> > **<Papierkorb>** Erm .. a string can't be modified either in Crystal ⏎ ⏎ String#camelcase ?
<Papierkorb> doens't modify the string itself
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <monouser7dig> your right, `Converts underscores to camelcase boundaries.` does not say it though, the other methods say `returns a new string`, good lesson though
<FromGitter> <HCLarsen> Wait, strings are immutable in crystal?
<Groogy> GAH WHERE ARE MY WALLS ENDING UP ;_;, I've added so the vertices should be generated and I can see the mbe added but I can't see them
<Groogy> oooh.. I'm dumb..... (οΎ‰ `Π”Β΄)οΎ‰ ~┻━┻
<Groogy> I forgot to set w component to 1....
<Groogy> I hate math
<FromGitter> <zyriuse75> i would want to check if the script running is by root or not . i try to use without sucess 😟 do you have an idea how i can do that ?
<FromGitter> <monouser7dig> root? = `whoami` == "root\n"
<FromGitter> <monouser7dig> πŸ‘
<Papierkorb> JSON::PullParser thinks -1 is a UIntX
<Papierkorb> Well, `#read?` happily reads it as such. Including the value underflow from the negative number
alex`` has quit [Ping timeout: 255 seconds]
claudiuinberlin has quit [Quit: Textual IRC Client:]
<Groogy> last one before I head to bed
<Groogy> all natively Crystal, all super blazing fast :D
<FromGitter> <HCLarsen> I don't see anything in the documentation about getters and setters. Is there no attr_accessor methods in Crystal?
DTZUZO has quit [Ping timeout: 255 seconds]
<Groogy> there are
<Groogy> getter, setter and property
<Groogy> some example for you
sz0 has quit [Quit: Connection closed for inactivity]
<Papierkorb> HCLarsen, and so on
<Papierkorb> Groogy: Even if simple, looks like a decent FPS for that scene
<Papierkorb> HCLarsen, one of the best features of getter must be the block version. Free lazy-initialized values :)
<oprypin> wait what
<oprypin> yeah i always forget about that one
<Groogy> Papierkorb, yeah similar in Ruby would be way way lower
<Papierkorb> Groogy: And compared to C/C++?
<Groogy> about the same is my gut feeling
<Groogy> It is not GPU bound here but CPU bound since it is minimal amount of vertices and only like 1 draw call
<Papierkorb> yayβ„’
<Groogy> I would also guess that Crystal is doing an excellent job deducing types so most calls doesn't become virtual
<Groogy> no stats on that though but looking at how some parts with the renderer behaves its what I think
<Papierkorb> thank you llvm
<Groogy> typeof(obj) will give me the compile time type right? Not the runtime one?
<Papierkorb> typeof is compile time, .class is runtime
<Groogy> huh color me wrong, it seems like this evaluates to the base class, hmm then what was that error I got before....
<Papierkorb> good night
<Groogy> good night!
zeno_ has joined #crystal-lang
zeno_ has left #crystal-lang [#crystal-lang]
wazzeno has joined #crystal-lang
<wazzeno> Hello everyone! I was wondering if anyone could tell me how to use "crystal docs" with the embedded source code snippets like in crystal lang's API docs. Is there anywhere this is documented? (crystal docs --help doesn't seem to do the trick) Thanks!
<FromGitter> <georgeu2000> I believe the following code is threadsafe? ⏎ ⏎ ```class Foo ⏎ def bar ⏎ "baz" ⏎ end ⏎ end``` []
<FromGitter> <georgeu2000> ``
<FromGitter> <georgeu2000> So multiple threads can call `` at the same time...
<Groogy> Ooooh...... Ran it in release now Papierkorb, Then its 8k FPS
<Groogy> not a lot of code in the example, yeah but still didn't expect 8k from Crystal so pleasantly suprised
<watzon> Is that a voxel world generator Groogy
<watzon> Looking awesome
<Groogy> no just vertices
<FromGitter> <georgeu2000> How do I read the body of an HTTP request? ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <georgeu2000> ```undefined method 'gets_to_end' for Nil (compile-time type is (IO | Nil))``` ⏎ ⏎ how can it be nil? []
<FromGitter> <HCLarsen> I don't understand what gets_to_end is supposed to do.
<FromGitter> <HCLarsen> But request.body is a string, so just read it like you would any string.
<FromGitter> <georgeu2000> request.body is a `FixedLengthContent` so read does not work.
<FromGitter> <georgeu2000> ```puts @http_request.body ⏎ #<HTTP::FixedLengthContent:0x10c44d540>``` []
<FromGitter> <HCLarsen> Try using HTTP::Client.get
<FromGitter> <HCLarsen> That response from that has a body that's a string.
<FromGitter> <georgeu2000> I am writing a server...
<FromGitter> <georgeu2000> ```server =, port) do |context|```
<FromGitter> <georgeu2000> This is the `context.request`: ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <georgeu2000> I found out how: `@http_request.body.try(&.gets_to_end)`
<FromGitter> <georgeu2000> But I don't know how this fails at compile time: ⏎ ⏎ ```if !@http_request.body.nil? ⏎ puts @http_request.body.gets_to_end ⏎ end``` []