ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.22.0 | Fund Crystal's development: | Paste > 3 lines of text to | GH: | Docs: | API: | Logs:
<FromGitter> <drosehn> when people here mention `sth`, what does that refer to? I hope it isn't some Sith overlord.
Raimondi has quit [Write error: Broken pipe]
Raimondi has joined #crystal-lang
balduin has joined #crystal-lang
balduin has quit [Client Quit]
zipR4ND1 has quit [Ping timeout: 260 seconds]
balduin has joined #crystal-lang
balduin has quit [Client Quit]
_whitelogger has joined #crystal-lang
unshadow_ has joined #crystal-lang
unshadow has quit [Ping timeout: 240 seconds]
go|dfish has quit [Ping timeout: 260 seconds]
yogg-saron has joined #crystal-lang
go|dfish has joined #crystal-lang
<FromGitter> <ravernkohdev> Hi
<FromGitter> <ravernkohdev> Is there currently a Crystal binding to the Curses library?
Yxhuvud has joined #crystal-lang
<FromGitter> <crisward> I'm listing the files in a directory with `Dir.entries(path)`, on a mac this seems to be in alphabetical order, on linux it isn't. Anyone know the reason for this and work around? I could sort the array, but if their is just some setting I'm missing that may be preferable. Thanks.
<Yxhuvud> Do you get the same behaviour in other languages? If so, the workaround is to sort manually
<FromGitter> <crisward> <Yxhuvud> Don't think so, bash certainly orders them, as does node.
<FromGitter> <drosehn> I'd prefer that `Dir.entries` never sorted. If I want the directory sorted, I can sort them easy enough. Shells do sort them if you use a pattern on a command-line, but they aren't stored in a sorted order.
<FromGitter> <drosehn> They may happen to be sorted, depending on how the files were put in the directory.
<Yxhuvud> I also wouldn't put it past the mac people to have OS api's that give sorted entries back.
<FromGitter> <drosehn> I just checked on macOS 10.10 with `Crystal 0.22.0 (2017-04-23) LLVM 4.0.0`, and the entries were not automatically sorted. They're also not automatically sorted in ruby, and I'm pretty sure they're not automatically sorted in perl either.
<FromGitter> <drosehn> they're certainly not automatically sorted in C.
<FromGitter> <drosehn> If you find yourself dealing with large directories, an automatic-sort step could be pretty noticeable overhead that you may want to avoid. If you want them sorted, just do `Dir.entries(somepath).sort`
<FromGitter> <crisward> @drosehn thanks... I run my crystal app in a docker container with a directory exposed to my host os
<FromGitter> <crisward> I'm finding the only inconsistencies are with this part of it
<FromGitter> <crisward> Can't ever envisage going full linux for dev though...
<FromGitter> <drosehn> I don't know about docker containers, or what order files were placed in the directory (or directories) that you're looking at. I just wrote a 5-line program using `Dir.entries()` as an array, and the files were not processed in alphabetical order.
<FromGitter> <drosehn> I'm going to test a slightly different program though. give me a minute here...
<FromGitter> <drosehn> yeah, it's the same with `Dir.foreach() {block}` on macOS. They are not processed in sorted order.
<FromGitter> <careo> It's worth sorting them explicitly yourself, even if the underlying call returns them sorted. I've hit cases in ruby where directory listings would be sorted differently between OS X and Linux.
<FromGitter> <careo> Was good for hours of "worked fine in dev, must be ops' fault" :smile:
<FromGitter> <drosehn> If you're using `Dir.entries()`, is it all that much work to type 5 extra characters to sort the array?
<FromGitter> <crisward> @drosehn not at all, just wanted to know if I was missing something.
<FromGitter> <drosehn> aside: I happened to use `Dir.foreach()` on a directory just a few days ago, and the filenames came out sorted. I just now realized that in the directory I was working on, the files had been added into that directory in sorted-order...
DeBot has joined #crystal-lang
<FromGitter> <crisward> BTW was wrong about node... @drosehn I think you may be right, I think I've rsynced my folder from the server which may have done the ordering
<FromGitter> <drosehn> I should admit that I've never used node directly, so I don't know about that one. I do know that shells will sort the filenames matched by a pattern, such a `echo *`.
<FromGitter> <drosehn> (although in some platforms the filenames are sorted into case-insensitive order, and other platforms may use case-sensitive order).
wuehlmaus has quit [Quit: Lost terminal]
<unshadow_> Why is there such a differece between debug and release mode ?, it seems that programs which runs great in debug crash terrebly when compiling in release
DissonantGuile has quit [Ping timeout: 240 seconds]
<FromGitter> <crisward> <unshadow_> are you short on memory? I've found releases can use more memory after an uncaught exception.
<unshadow_> crisward: Ill check it out, but I would think that 16Gb is enough ;)
<FromGitter> <crisward> when I see increase, I mean < 100mb. So yeah, 16gb will be fine.
<unshadow_> crisward: I opened a bug at the git => Maybe someone can shed some light into this
<Yxhuvud> You probably need to post a complete runnable example.
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
bjz has joined #crystal-lang
<FromGitter> <KCreate> Didn't know you can use lldb with crystal binaries
<FromGitter> <KCreate> how good is it supported?
zipR4ND has joined #crystal-lang
wuehlmaus has joined #crystal-lang
DissonantGuile has joined #crystal-lang
splitty__ has joined #crystal-lang
splitty_ has quit [Ping timeout: 252 seconds]
bjz has quit [Ping timeout: 240 seconds]
bjz_ has joined #crystal-lang
<FromGitter> <mverzilli> @KCreate very basic support. you can step through the code and inspect very low level things as the stack frame or registers, but not do things like "watch variable x"
<FromGitter> <KCreate> cool, i'll check it out once i'm home :smile:
<FromGitter> <mverzilli> I use VSCode, and with this plugin you even get a nice UI:
<FromGitter> <KCreate> What about breakpoints?
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mounibec has joined #crystal-lang
<FromGitter> <mverzilli> that works
pduncan has joined #crystal-lang
bjz_ has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
<BlaXpirit> drosehn, i think 'sth' is just 'something', not specific to here
zipR4ND has quit [Ping timeout: 258 seconds]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
mounibec has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
A124 has quit [Quit: '']
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
A124 has joined #crystal-lang
mounibec has joined #crystal-lang
A124 has quit [Quit: '']
A124 has joined #crystal-lang
unshadow_ has quit [Ping timeout: 260 seconds]
unshadow has joined #crystal-lang
<FromGitter> <erunks> Anyone in here familiar with shards?
<FromGitter> <KCreate> What do you need to know?
<FromGitter> <erunks> I think I'm having an issue as far as linking the dependencies for a new project
<FromGitter> <erunks> I'm trying to use stumpy_png, fyi
<BlaXpirit> erunks, so post what you're doing, what you're getting, and why it's not what you expected
<FromGitter> <erunks> Here is everything in my right now: ⏎ ⏎ ```/usr/bin/ld: cannot find -lz ⏎ collect2: error: ld returned 1 exit status``` []
<BlaXpirit> erunks, install zlib
<FromGitter> <erunks> I'm assuming that zlib isn't a standard package, do you know what dependency I'd need to apt-get install that?
<BlaXpirit> search engines know
<FromGitter> <elthariel> @mverzilli : I've created a page for your future notes on the work on thread support : ⏎ I've also added build instructions, as it's not straightforward
<FromGitter> <elthariel> I might be doing something wrong as the specs seems to pass :)
<FromGitter> <MatthewBennington> @erunks zlib is a very common package. Here is the first result for a google search "ubuntu install zlib"
zipR4ND has joined #crystal-lang
<FromGitter> <erunks> Wow. I'm surprised that needing an additional package like that wasn't stated in the readMe. I though mtools was what I needed for the longest times after searching around
<FromGitter> <erunks> But I got it now. Thanks guys
<FromGitter> <MatthewBennington> It's a common package, so the creators probably assumed it would already be installed. You should probably open an issue about this.
<FromGitter> <erunks> Good point. I'll do that
<FromGitter> <l3kn> This surprises me, too. stumpy_png is just using the zlib stuff from the stdlib
unshadow has quit [Ping timeout: 255 seconds]
zipR4ND1 has joined #crystal-lang
zipR4ND has quit [Ping timeout: 240 seconds]
unshadow has joined #crystal-lang
<FromGitter> <mverzilli> but the stdlib in turn uses zlib
<BlaXpirit> crystal does not guarantee that all stdlib will have its matching dependencies
<BlaXpirit> especially depending on installation method
<FromGitter> <mverzilli> @elthariel thanks! I'll check it out when I have a minute
<BlaXpirit> libxml comes to mind as the most frequent offender
zipR4ND has joined #crystal-lang
zipR4ND1 has quit [Ping timeout: 252 seconds]
sz0 has joined #crystal-lang
zipR4ND has quit [Ping timeout: 260 seconds]
<FromGitter> <l3kn> Interesting, I'll add a note to the readme
zipR4ND has joined #crystal-lang
unshadow_ has joined #crystal-lang
unshadow has quit [Ping timeout: 260 seconds]
<FromGitter> <MatthewBennington> I'm worried that I'm spamming this channel with questions, so if it gets to be too much, please let me know. That being said, I am hoping someone can help me with an issue I'm having binding the ncurses c lib.
<FromGitter> <bew> there is already an ncurses shard, why not use it?
<FromGitter> <MatthewBennington> I've got a line `fun has_colors : Bool` when I call it, I get the following error: ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <MatthewBennington> shit
zipR4ND has quit [Ping timeout: 260 seconds]
<FromGitter> <MatthewBennington> I get the following error: ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <MatthewBennington> When I try to call `fun has_colors : Bool`
<FromGitter> <MatthewBennington> Sorry, about the formatting there
<FromGitter> <MatthewBennington> Which shard?
<FromGitter> <MatthewBennington> There are 4 ncurses shards, all with different amounts of features. I personally like the way binds to ncurses, but it doesn't support colors yet.
<FromGitter> <bew> but I agree it's not complete
zipR4ND has joined #crystal-lang
<FromGitter> <bew> You could also start from
<BlaXpirit> MatthewBennington, please don't worry about asking on-topic questions
<FromGitter> <bew> But it's a lower level
<BlaXpirit> MatthewBennington, i can't tell what the problem is. maybe you can post a complete runnable example that causes this error.
<FromGitter> <MatthewBennington> Here's where the issue is
<BlaXpirit> MatthewBennington, not sure if that's part of the problem but @[Link is not a standalone thing, it attaches to the lib that follows it, so you better change that
zipR4ND has quit [Ping timeout: 268 seconds]
<BlaXpirit> i cannot reproduce, runs fine for me
<FromGitter> <MatthewBennington> Interesting
mounibec has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<BlaXpirit> uhh though i isolated it to just has_colors, instead of running your actual example, that could be important
<FromGitter> <MatthewBennington> Nah, I tried just has colors, and it crashed on me.
<FromGitter> <MatthewBennington> Must be something about my machine. I'll try it in C and see it it fails still
<FromGitter> <MatthewBennington> Also can you explain what you mean about @[link ?
<BlaXpirit> MatthewBennington, your code currently says that to use setlocale you need to link to ncurses, while all the rest functions don't need any library
<FromGitter> <MatthewBennington> Huh, then how the heck is it working?
<BlaXpirit> well because linking in practice is not that granular
<BlaXpirit> but there may be some edge case where it does break
<FromGitter> <MatthewBennington> Well this is not my code, you (or I) could open an issue in the actual repo.
<BlaXpirit> oh huh
dannyAAM has quit [Quit: : ZNC 1.6.2 -]
zipR4ND has joined #crystal-lang
<FromGitter> <sdogruyol> @elthariel thank you
dannyAAM has joined #crystal-lang
<unshadow_> read wont raise , even on closed sockets
Aytan72 has joined #crystal-lang
<Aytan72> Howdy
<BlaXpirit> unshadow_, but that's totally normal
<Aytan72> I'm considering using crystal as a micro-service to a RoR project because of the performance increase. Is crystal production ready?
<unshadow_> BlaXpirit: Is it ? It should raise an Exception no ? the end point is disconnected
<Papierkorb> Aytan72: Mission critical stuff? No.
<unshadow_> BlaXpirit: How else would I know if the socket is even alive ? I could just try to read from it forever
<BlaXpirit> unshadow_, i dont know what it should but i know that in C and Python (which uses exceptions very often), a normally closed socket just returns 0 when there's nothing more to read
<Papierkorb> Aytan72: The stdlib API isn't stable, some syntax changes could still arise (Though are becoming less likely). No threading support *yet* either.
<BlaXpirit> and that's how you know - you check for 0
<Aytan72> Papierkorb: Yeah, I need something faster than ruby for incoming data streams and calculations
<Papierkorb> Aytan72: However, for something non-mission critical? Give it a try. I wouldn't base a company around it yet, but for something less important-ish, at least try it.
<unshadow_> BlaXpirit: 0 = nothing to read (makes sense) , 0 != other socket is dead, this should raise, how else would you know if the other socket is connected or not ? what if the server just don't have anything to send right now ?
<BlaXpirit> unshadow_, then the call blocks
<unshadow_> BlaXpirit: It wont, we use non_blocking sockets
<Papierkorb> Aytan72: Even if you don't end up liking it, you can easily port the code back to ruby for now. Not much lost in this worst-case scenario.
<Aytan72> I should wait for 1.0 then?
<BlaXpirit> unshadow_ pls
<Papierkorb> Aytan72: is that micro service mission critical?
<Aytan72> Papierkorb: That's why I'm really interested in crystal. Ruby syntax and amazing performance
<Aytan72> Papierkorb: Yes it is
<unshadow_> pls ?
<BlaXpirit> unshadow_, I would like to see an example that checks whether will block when nothing is being sent
<Papierkorb> Aytan72: *I* would think about it, but to be fair, I wouldn't recommend it for every case. Is it a one-time thing, or a service that is expected to run for years to come?
<Aytan72> Papierkorb: The application relies 100% on the incoming data streams after they are processed (run through calculations too), and then served to a RoR application in near-realtime
<BlaXpirit> and i'm about 99% sure that it will block
<BlaXpirit> unshadow_, it's another question that crystal probably does use nonblocking sockets under the hood, but presents them as blocking
<unshadow_> BlaXpirit: you can see my github issue, even though the socket is closed on the client, it will keep reading Bytes[] forever, it wont block
<BlaXpirit> unshadow_, why would it block if the socket is closed
<BlaXpirit> it returns 0 indicating there is no more data to be read
<Aytan72> Papierkorb: I'm on the fence. I will probably try it anyways, because of the syntax compatibility
<Papierkorb> Aytan72: I want to suggest to you giving crystal a try (Maybe you can port the slow ruby code to crystal as a try out), but I won't recommend you to use it just yet without a backup plan. I'm just trying to be honest, I like Crystal, but it still has its flaws
<unshadow_> BlaXpirit: wait ... you said the call will block if the socket is closed ... did I misunderstood you ?
<Aytan72> Papierkorb: I really appreciate your honest advice. All I know is that Crystal looks really promising and I'm excited about the future releases
<BlaXpirit> > what if the server just don't have anything to send right now ? > unshadow_, then the call blocks
<BlaXpirit> probably misunderstood me
<Papierkorb> Aytan72: a backup plan might be keeping the slow ruby codebase in sync, so if the crystal daemon were to fail, you can switch to it quite easily. Don't expect it to fail, if it compiles and runs for an hour, it will run for the next days too, etc. - The issue might also arise later when a stdlib API changes (There is a CHANGELOG for this though) and you didn't do proper testing (or it's hard-to-test), it might fail on a later crystal
<Papierkorb> compiler version "silently"
<unshadow_> BlaXpirit: Oh, ok, in that case it will read 0, because the Crystal socket is 100% non_blocking, you can take my github example and just dont close the client socket, You will see it returns imidiatlly with 0 read
<unshadow_> And that's my issue, as both closed socket and server has nothing to say returns 0 which means I can't handle a closed socket :\
<Aytan72> Papierkorb: I'll proceed with caution. Mostly when switching between versions.
<Papierkorb> Aytan72: That sounds perfectly reasonable
<BlaXpirit> unshadow_, your example is just doing something weird, i'll post a better one
<unshadow_> K
<Aytan72> Papierkorb: Thanks a bunch for your help
<Papierkorb> cheers
<unshadow_> This one is better ? wont respond before you send a GET / request, in my example, you will get back the Bytes[] and not the "socket is dead"
<BlaXpirit> closed? probably tells you whether you have closed it on your end, it will never be true
<BlaXpirit> so uh worse
<BlaXpirit> i posted on . recommend closing.
<unshadow_> BlaXpirit: Hm..... seems you are right, Bytes[] (or "size == 0") indicates a closed socket.
<unshadow_> BlaXpirit: I'll close my issue, thanks
unshadow has joined #crystal-lang
unshadow_ has quit [Ping timeout: 258 seconds]
<FromGitter> <sdogruyol> hey @elorest great talk at RailsConf
<FromGitter> <elorest> Thanks @sdogruyol
<FromGitter> <sdogruyol> i liked your picture lol
<FromGitter> <elorest> I tried talking the Helix gusy into crystal too. At least got them to concede they should look into it more.
<FromGitter> <sdogruyol> but you really need a crystal and kemal sticker :P
<FromGitter> <elorest> I do have a crystal sticker.
<FromGitter> <sdogruyol> didnt see it on your mac
<FromGitter> <sdogruyol> :/
<FromGitter> <andrealmar> @sdogruyol link for the talk?
<FromGitter> <elorest> It’s there. by the tenderlove cat.
<FromGitter> <elorest> I gave out 200 crystal stickers at the conference.
<FromGitter> <sdogruyol> AWESOME!
<FromGitter> <andrealmar> nice thx
<FromGitter> <sdogruyol> @andrealmar thank you too for the videos
<FromGitter> <andrealmar> you're welcome @sdogruyol . I will do more videos for sure. First targeting on beginners as I'm learning Crystal too
<FromGitter> <sdogruyol> that's great
<FromGitter> <elorest> @sdogruyol glad you liked my picture. :)
<FromGitter> <sdogruyol> it's really cool
<FromGitter> <andrealmar> yep really cool picture
<FromGitter> <andrealmar> ruby + piano
<FromGitter> <andrealmar> plus windy hair
<FromGitter> <sdogruyol> :D
<FromGitter> <sdogruyol> btw @elorest are you coming to codecamp
<FromGitter> <elorest> yep
<FromGitter> <sdogruyol> lovely
<FromGitter> <sdogruyol> have you found a place to stay?
<FromGitter> <elorest> Need to get on that again. I have my flight and tickets to the thing but that’s it.
<FromGitter> <sdogruyol> lol same here i'm still have nowhere to stay :D
<FromGitter> <elorest> let me know if you find anywhere good. I’ll look tomorrow. Trying to catch up at work after railsconf.
<FromGitter> <sdogruyol> sure
<FromGitter> <dmitryrck> :+1:
zacts has joined #crystal-lang
<zacts> hello
<FromGitter> <bew> Hi
<FromGitter> <jwoertink> Anyone here that understands web sessions that has a min to help me with something?
<BlaXpirit> assuming i had a minute, it would be wasted on waiting for you to type the actual question
<FromGitter> <jwoertink> Yeah, that's the thing about trying to ask for help also while being at work and having to do that stuff first
<FromGitter> <jwoertink> plus I think my question is better suited for the kemal room, so I'm moving it over to there
<FromGitter> <elorest> We’ll fine then. We don’t need you here anyway. :)
<FromGitter> <jwoertink> haha :p
<FromGitter> <elorest> shouldn’t have deleted my comment lol. Now yours is out of place.
<FromGitter> <jwoertink> thanks
<FromGitter> <elorest> You’re welcome.
<FromGitter> <chuckremes> Ran across this good blog post in my feed pitting Crystal & Kemal vs Ruby & Rails & Sinatra.
<BlaXpirit> i've seen like 5 posts just like this already
<FromGitter> <jwoertink> It's a cool post; however, the SQL calls are different, and it's not really fair to compare kemal to rails since rails has so much more going on. But from a learning standpoint, it's great!
<FromGitter> <elorest> Everyone loves saying ruby is slow at this point. I’d love to see it benchmarked against phoenix or something.
<FromGitter> <elorest> Problem is that 20 µs won’t look that different from 400 µ when db requests take 8ms.
<FromGitter> <mverzilli> agree. I would love to see more blogposts comparing the experience of refactoring code as opposed to just comparing performance
<FromGitter> <mverzilli> of course, there's still not many people out there maintaining a live Crystal app for months, so that perspective is more difficult to find that simply running small benchmarks
<FromGitter> <elorest> yeah that too. I think that’s why rails is still a thing. It’s fast enough for a lot of applications and still has more developer happiness than elixir and node.
<FromGitter> <elorest> I think that crystal apps have the potential to be more stable since we have compiler checks and won’t run into issues like something magicly being nil the first time the client tests it.
<FromGitter> <mverzilli> right, I think that aspect of Crystal is generally underestimated, but again, it's a matter exposure
<FromGitter> <mverzilli> we built good relationships with many clients thanks to how fast it was for us to prototype things they didn't know they wanted with Rails
<FromGitter> <elorest> I had a pretty interesting conversation with DHH yesterday about ruby values and other communities that they exist in now too.
<FromGitter> <mverzilli> nice!
<FromGitter> <elorest> he seemed far less opinionated this year than in years past.
<FromGitter> <bew> in which direction?
<FromGitter> <elorest> he appologized for saying tdd was dead. He admitted that other communities have good idea’s too and that rails isn’t the one true framework.
<FromGitter> <sdogruyol> he's definitely having an enlightment or smth
<FromGitter> <ltran> getting older ;)
<FromGitter> <elorest> yeah
<FromGitter> <sdogruyol> :D
<FromGitter> <sdogruyol> kids are growing older maybe
<FromGitter> <sdogruyol> lol
<FromGitter> <bew> nice improvment
<FromGitter> <bew> !
<FromGitter> <ltran> wisdom comes with age
<FromGitter> <elorest> Either that or you become even more stuck in your ways.
<FromGitter> <bew> (and experiences)
zipR4ND has quit [Ping timeout: 255 seconds]
<FromGitter> <elorest> We were in Phoenix so @tenderlove made the joke. “If Rails is so great why isn’t there a city named after it?"
<Yxhuvud> :D
mounibec has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
<FromGitter> <bew> Is there a way to get the last enum value in a lib declaration?
<BlaXpirit> in a lib declaration, huh
<BlaXpirit> bew, i mean, this can be helpful
mounibec has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<BlaXpirit> i think lib declaration makes no difference
<FromGitter> <bew> I'm trying to avoid this :
<BlaXpirit> basically u probably want {{ SomeLib::SomeEnum.constants[-1] }} - should work..?
<BlaXpirit> bew, so does that work for you or not?
<FromGitter> <bew> I'm trying sth simple to test
<FromGitter> <bew> macros doesn't work in enum (in lib)
<FromGitter> <bew> :/
<BlaXpirit> bew, ugh that sucks. oh well, don't put them inside lib, it's pointless
<FromGitter> <bew> yeah, I'll just replicate the .h
<BlaXpirit> lib is only absolutely needed for `fun`
<FromGitter> <bew> ah
<FromGitter> <bew> macros doesn't work in enum declaration (even outside lib)
<FromGitter> <bew> :/ ++
<BlaXpirit> right..
<FromGitter> <bew> I'll just replicate the header, it's just the lib, it's not a vbig deal, I'll do a cleaner crystal interface to that lib anyway!
BlaXpirit is now known as oprypin
oprypin is now known as BlaXpirit
<BlaXpirit> changing my nick to 'oprypin'
BlaXpirit is now known as oprypin
<FromGitter> <bew> BlaXpirit was a nice name
oprypin has quit [Quit: Bye]
<FromGitter> <oprypin> unprofessional :|
<FromGitter> <bew> why not?
bjz has joined #crystal-lang
<FromGitter> <bew> possible bug: in lib, I can't declare a `module` but I can declare a `enum SomeModule::MyEnum`
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
oprypin has joined #crystal-lang
<FromGitter> <bew> (and it works)
<FromGitter> <bew>
<oprypin> yeah.... maybe it should be disallowed one day
<FromGitter> <bew> I like it finally: (allow good separations in lib, and still easy access in integration code)
<oprypin> bew, being able to make namespaces inside lib is a bug. i'm not sure why you even want this in the first place
<oprypin> if you want to expose an enum in your shard, i recommend writing it outside of lib immediately
<oprypin> the alias thing turns out terribly in documentation
<FromGitter> <bew> hmm you're right, thx
<FromGitter> <KCreate> Hey, is it possible to make a type restriction for two variables? ⏎ I mean: ⏎ ⏎ ```code paste, see link``` []
<FromGitter> <KCreate> i know it's possible with macros but i'm curious if there's a built-in method for this
<oprypin> typeof(a, b) == Int32 i think
<oprypin> not entirely sure what you mean
<oprypin> no.. just do a.is_a?(Int32) && b.is_a?(Int32)
<FromGitter> <bew> your snippet with typeof works, na?
<oprypin> typeof won't do it, it checks the compiletime type, and i think a runtime check is wwanted here
<oprypin> that snippet will never be true basically
<FromGitter> <bew> oh good catch :+1:
<FromGitter> <bew> no way to create a `String` from a `Pointer(Char)` ?
<FromGitter> <Sija> ``
<FromGitter> <bew> `no overload matches '' with type Pointer(Char)`
<FromGitter> <bew> ...
<FromGitter> <Sija> well, there’s ` : Pointer(UInt8))`
<oprypin> bew, uhm it's supposed to be LibC::Char
<oprypin> or are you actually dealing with 32-bit unsigned integers?
<FromGitter> <bew> oooh ok I just understood why there where `Char` in the `LibC` I looked, I was thinking there where some magic about `Char` in lib declaration....
<oprypin> bew, i think there is indeed magic - types inside `lib` come from LibC by default
<FromGitter> <bew> wut?? what do you mean?
<RX14> lol, BlaXpirit and oprypin hash to the same colour on hexchat
<oprypin> nevermind. but i ish it was like that
<FromGitter> <Sija> @bew maybe u mean `String#to_unsafe` which returns `LibC::Char*`?
<oprypin> Sija, nah it's about correctly binding a `lib` - writing Char vs LibC::Char
<FromGitter> <Sija> allrighty, nvm then
<FromGitter> <bew> issue resolved for me, nvm Sija
<FromGitter> <bew> yep
Aytan72 has quit [Remote host closed the connection]
<FromGitter> <elthariel> @mverzilli @sdogruyol You're welcome, my pleasure