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
duane has quit [Ping timeout: 268 seconds]
jnyw has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
alex`` has quit [Ping timeout: 240 seconds]
<FromGitter> <aisrael> Hi! When building a Kemal-based app under Alpine, when I try to run it in a “fresh” alpine container (am docker-izing), I kept running into run-time failures mainly due to shared libraries. Is there any way to compile a final executable with statically linked everything (like, how Go does it)?
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> you can only statically compile crystal programs in alpine
<RX14> and if you're running it in alpine in docker
<RX14> just build in alpine and you're fine
<RX14> static or not
<FromGitter> <watzon> How log do you guys think it will be before we have real concurrency in Crystal? With multi-threading as opposed to fibers.
<FromGitter> <watzon> This year perhaps?
cremes has joined #crystal-lang
<FromGitter> <ShriekBob> You know, I thought we alraedy had threads
<FromGitter> <watzon> Nope. Currently Crystal uses fibers instead. They
<FromGitter> <watzon> are more lightweight
<FromGitter> <watzon> But they don't provide true multi-threading
<FromGitter> <watzon> I'm looking through the issues in Github right now, but I'm not seeing anything about Threads
<FromGitter> <ShriekBob> Oh...man that's likely a bit of a games engine deal breaker
<RX14> fibers mean crystal is super fast for IO bound workloads
<RX14> but not CPU bound
<FromGitter> <watzon> Right
<RX14> well, CPU bound and parallelizable workloads
<RX14> games tend to be CPU bound
<FromGitter> <ShriekBob> Aye, 5-30 threads is where my engines usually end up
<FromGitter> <watzon> So implementing a CPU miner in Crystal is a no-go at the moment
<RX14> well you can
<FromGitter> <ShriekBob> depending on whether I go full blown job system, or just single thread, single system
<RX14> isn't mining not very much communication between threads?
<FromGitter> <watzon> You're probably right there
<RX14> if thats the case you can just use multiple processes and RPC/pipes/whatever
<FromGitter> <watzon> Hmm I didn't think about that
<FromGitter> <ShriekBob> IS there any intention of supporting both in the long term?
<FromGitter> <watzon> Can you assign a process to a CPU core? I don't know how that stuff works
<RX14> yeah
<RX14> we'll probably have concurrency... sometime soon
<RX14> @watzon you dont need to
<RX14> spawn as many processes as cpu cores
<RX14> the OS scheduler will work it out
<FromGitter> <watzon> Ahh ok. And they get automatically assigned
<RX14> no
<RX14> they just get scheduled
<RX14> the linkux krnel devs are smarter than you )
<RX14> wow i need to sleep
<RX14> bye
hightower has quit [Ping timeout: 252 seconds]
<FromGitter> <watzon> Gotcha haha
<RX14> Its simple, you have n processes which are busy
<RX14> And n cores
<RX14> And nothing much else to be done
<RX14> Its unlikely your process will change cores ever because there's no reason for it
<RX14> And if the kernel was leaving a cpu free that would be a terrible kernel wouldn't it
<FromGitter> <watzon> Truth. Ok that makes sense. So just spawn the same number of processes as CPU cores.
<FromGitter> <ShriekBob> If you're getting a lot of cache misses you can spawn numCores*1.2 or some such and probably improve performance, if you're doing a lot of IO to disk, then you can probably do even more than that
<FromGitter> <ShriekBob> actually, I don't know if that holds true for processes
<FromGitter> <ShriekBob> I just use as a rule of thumb for threads
<Papierkorb> RX14: In fact, processes do change cores when the kernel sees fit, and do so somewhat often. There were bugs some years ago in Linux that would make it reschedule processes across NUMA boundaries too, completely thrashing performance
<RX14> Somewhat often
<RX14> Meaning on the scale of seconds on cpu workloads
<RX14> 1 second is a million years to a cpu
<Papierkorb> Only about 100 time slices or so
<FromGitter> <watzon> How would you take a process and pipe its output to STDOUT?
cremes has quit [Quit: cremes]
<FromGitter> <bew> How do you define "its output" if it's not "what's on stdout" ?
<FromGitter> <watzon> Don't spawned processes capture the STDOUT? If I try to do `puts` in a spawned process for example, nothing happens.
<FromGitter> <watzon> All I want to do is have each process I spawn write to the terminal
<FromGitter> <watzon> Hmm maybe I'm wrong
<FromGitter> <bew> Are you spawning them from Crystal? If yes, just add `output: Process::Redirect::Inherit` to the Process spawning call
<FromGitter> <watzon> I'm using `Process.fork` to do the spawning
<FromGitter> <bew> Oh you're forking? Can't experiment right now, but I would think it should work without weird tricks
LastWhisper____ has joined #crystal-lang
<FromGitter> <bew> the output is OK for me: https://carc.in/#/r/3gbi (the process fork makes carc.in to crash, but the output is there)
<FromGitter> <watzon> Yeah I got it working. Thanks haha
tankfeeder has quit [Quit: Connection closed for inactivity]
<FromGitter> <faustinoaq> > This would probably be a great place to promote Crystal. They don't list Crystal as a language yet, so I had to write it in. ⏎ ⏎ @robacarp I did the same 😄
dragonkh has quit [Read error: Connection reset by peer]
gewo has quit [Ping timeout: 256 seconds]
cremes has joined #crystal-lang
<FromGitter> <watzon> Where is Crystal not listed?
cremes has quit [Quit: cremes]
<FromGitter> <bew> @watzon here https://stackoverflow.com/dev-survey/start/
gewo has joined #crystal-lang
vivus has quit [Quit: Leaving]
DTZUZO has quit [Ping timeout: 264 seconds]
greengriminal has joined #crystal-lang
duane has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
duane has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
cremes has joined #crystal-lang
cremes has quit [Client Quit]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #crystal-lang
LastWhisper____ has quit [Client Quit]
duane has quit [Ping timeout: 256 seconds]
codenoid has joined #crystal-lang
<codenoid> helo
<codenoid> i use IRC when my connection slow
<codenoid> < 20kbps, lolno
tankfeeder has joined #crystal-lang
<FromGitter> <Dillybob1992> just bought 6$ yearly 512mb vps. doing some testing with crystal and my server, really easy to set up
<FromGitter> <Dillybob1992> thank goodness for windows sub system of which i can compile crystal then just upload file. running/compiling on the vps takes over 2minutes lol my i7 2600 is a beast still :D
<FromGitter> <Dillybob1992> takes second on the i7 2600 :D
<codenoid> are you recompile your crystal app in vps ?
<FromGitter> <Dillybob1992> nope , just simply doing crystal src/MasterServer.cr takes over 2minutes
<FromGitter> <Dillybob1992> iuno why though, i think the host is throttling CPU power cheap VPS
<codenoid> $6 yearly ?
<codenoid> omg
<dyreshark> hosts are probably extremely heavily oversubscribed
<FromGitter> <Dillybob1992> here is a link to specs lol https://i.gyazo.com/b7dd941fece0623b3bd011644ac7b721.png
<FromGitter> <Dillybob1992> i bought the #1 package here (https://lowendbox.com/blog/woothosting-chicago-launch-amazing-deals/) form LowEndBox, if anyone needs there is still in stock
<codenoid> yeah
<codenoid> btw
<codenoid> what macro used for ?
<codenoid> & record
<FromGitter> <bew> what?
<codenoid> macros
<codenoid> and what is top level namespace
Ven`` has joined #crystal-lang
alex`` has joined #crystal-lang
ua has quit [Ping timeout: 240 seconds]
ua has joined #crystal-lang
Ven`` has quit [Read error: Connection reset by peer]
<livcd> on the other hand cheap hosts mean people will want to use low memory/cpu footprint languages like crystal and go
<FromGitter> <Dillybob1992> i just found out since im using a tcp server, i can't take advantage of cloudflare's protection (unless i use websockets), but the godot engine doesn't have websocket implementation (for the client). and i already spent a lot of time with my tcp server and i kinda like it a lot with crystal. are there other ways to hide the game server ip? i have rate limiting and stuff setup through iptables, but a
<FromGitter> ... full on ddos will still destroy me. i heard of GRE tunneling IPs, and BuyVM has those for 3$/month. but that will surely add latency lag wouldn't it especially if not on the same network. iuno what to do :X
Ven`` has joined #crystal-lang
hightower has joined #crystal-lang
mark_66 has joined #crystal-lang
hightower has quit [Ping timeout: 240 seconds]
hightower has joined #crystal-lang
hightower has quit [Ping timeout: 248 seconds]
<jnyw> " Tinalynge" Hi all. I'm trying to strip the leading non alpha character from that string. I ASSUME it's not regular whitespace since i've already used strip on the string, how do I remove it?
<shelvacu> if you just want to remove the first character, you can do `str[1..-1]`
<shelvacu> also `str.inspect` should show an escape code if it's not a regular space
alex`` has quit [Ping timeout: 240 seconds]
alex`` has joined #crystal-lang
<jnyw> shelvacu: tyvm
hightower has joined #crystal-lang
alex`` has quit [Ping timeout: 256 seconds]
codenoid has quit [Ping timeout: 256 seconds]
<FromGitter> <asterite> lchop works too
<RX14> llvm-config is basically impossible to use on windows
<RX14> since there's spaces in the path
<RX14> and it's basically impossible to escape them
codenoid has joined #crystal-lang
<vegai> does the crystal team have knowledge of actual people who would be using Crystal on Windows?
<RX14> uhh, why?
* vegai shrugs
<vegai> it's obviously not my call, but porting to Windows seems like a bit of a waste
<RX14> lol
<RX14> i've seen like 3 people this week come in and say they're waiting for windows
<vegai> huh
<RX14> not everybody's a web developer
<RX14> with a mac
<vegai> you're right, some use Linux
jnyw has quit [Quit: WeeChat 2.0.1]
<vegai> the windows folks have all that .NET stuff going on, though
<RX14> ...
<vegai> ok
<RX14> and the linux folks have all that C stuff going on
<RX14> why do we need crystal
<RX14> pack it up boys
<vegai> comparing C# to C, good one :)
<RX14> ok, C++
<RX14> same point
<vegai> still nope
<RX14> yeah I still don't understand your point
<RX14> I literally can't pass options with spaces in to the windows linker fuck you windows
<FromGitter> <xfbs> Why are you on windows anyways?
<RX14> to port crystal to windows
<FromGitter> <xfbs> Oh fuck me sideways
<livcd> I would say it's only a waste if you do not have resources to maintain parity with nix
<FromGitter> <xfbs> So you have to use the native linker and you can't use any of that MinGW or subsystem for linux goodness?
codenoid has quit [Ping timeout: 240 seconds]
<RX14> but you don't want to
<RX14> whats the point of windows support if everyone has to go through a 10 step install process
<RX14> with wsl or cygwin or whatever
<RX14> we just want people to install msvc and go
<livcd> wsl is not a windows support i do not understand why people think it is
codenoid has joined #crystal-lang
<livcd> vegai: dont forget people also want to write games and other kind of software in Crystal on Windows :)
hightower has quit [Ping timeout: 248 seconds]
hightower has joined #crystal-lang
<txdv> C# is nice
alex`` has joined #crystal-lang
<RX14> yeah, it's not too bad
<vegai> livcd: ah, I indeed did forget that
<RX14> <RX14> not everybody's a web developer
<RX14> <RX14> with a mac
<vegai> though I'm of the rather unpopular opinion that Windows should die already and game writers should move on :)
<livcd> why ?
<vegai> because the whole system is so different from all the others for no good reason
<vegai> which is why we're seeing RX14 in pain right now
<txdv> is he porting crystal to windows?
<RX14> having different systems is good
<vegai> and of course, there's the whole anti-open source thing they still are under
<RX14> making crystal portable is good
<RX14> even if windows is shit, porting to it makes crystal more portable to anything new
<vegai> sure, ok
<RX14> plus theres plenty of demans for crystal on windows
<livcd> arguably it's the other systems that feel more like js frameworks not windows :)
<RX14> pls, unix is far more sane than windows
<vegai> yeah. How easy has it been to implement wine under Linux versus implementing pretty good Linux support on Windows
<vegai> that's a testament to how well those systems have evolved
<RX14> well aparrently
<livcd> incomparable
<RX14> vegai, thats a terrible example
<vegai> is it?
<vegai> how?
<RX14> 99.9% of linux programs run on WSL
<RX14> like 50% of windows programs dont run in wine
<vegai> which is exactly my point
<livcd> i think the new microsoft is pretty reasonable we can't all be a hippies singing kumbaya and cherishing open source
<vegai> wine is a notoriously difficult project because of all the crap they have to emulate
<txdv> Is anyone porting crystal to windows?
<livcd> txdv: RX14 is
<vegai> implementing a linux support on another system is trivial in comparison
<txdv> RX14: how far along are you?
<FromGitter> <Dillybob1992> rx14 the hero we deserve
<livcd> txdv: check github
<livcd> vegai: you are talking from a perspective of "the linux way is the right way and everything else is crap"
<vegai> livcd: not at all! Rather that Windows is crap and everything else is rather ok
<txdv> obviously having everything in your system represented by a file
<txdv> is the right way
<livcd> vegai: then you are terribly mistaken
<RX14> lol unix is crap too
<RX14> just less so
<txdv> The advanced programmer knows that everythign is shit
<txdv> Look at this fine specimen
<RX14> everything is shit except my code :)
<txdv> are you a narcissist RX14 ?
<vegai> yeah, your code is quite good :)
<livcd> txdv: reddit mentioned 35% as the current status
<RX14> txdv, no it's a joke
<RX14> my code sucks
<RX14> so it's been 1 hour
<RX14> still trying to escape a space in a filename
<RX14> still failing
<vegai> livcd: how would you explain wine, a multi-decade project, not being quite there yet, but linux-on-windows is already almost perfect?
<txdv> do spaces in file names on widnows work?
<FromGitter> <Dillybob1992> lol
<FromGitter> <straight-shoota> RX14 what's the issue?
<RX14> windows
<RX14> no matter what combination of "" and ^ I use for escaping
<RX14> nothing works
<FromGitter> <straight-shoota> why do you need whitespaced filenames anyway? :P
<RX14> because thats where LLVM is installed
<RX14> Program Files
<Papierkorb> lawl
<Papierkorb> tried double escaping?
<RX14> yes
<RX14> and I lost my cmake command
<RX14> so I can't be bothred to install it somewhere else
<RX14> maybe I should just copy the lib dir to somewhere
<FromGitter> <straight-shoota> would be easier than spending another hour
<RX14> I even tried a symlink
<RX14> with no spaces
<RX14> didn't work
<RX14> time to make the compiler compile on windows: 1 hour
<RX14> time to make windows accept the fucking linker command: 3 hours
<Papierkorb> And while WINE mainly comes from volounteers who (for fair reasons) implement mainly what they need, WSL was 100% done by paid devs. And I'd also wager that windows kernel API as viewed from user land is simply batshit insane compared to the few things linux provides. BSDs also had linux emulation layers over a decade ago.
<RX14> damnit
<FromGitter> <straight-shoota> are you really that far that you can compile the compiler??
<RX14> yeah lol
<Papierkorb> WINE also runs completely in usermode, while WSL requires kernel mode stuff. That's a testament on how powerful the linux API is compared to WinAPI in my book
<FromGitter> <straight-shoota> amazing
<RX14> all you need is File, Dir, and Process
<RX14> thats it
<RX14> the compiler is mostly pure computation
<RX14> well
<RX14> after you stub out the playground
<RX14> because who needs that
<FromGitter> <straight-shoota> yeah
<FromGitter> <straight-shoota> playground is not really that useful but can help get people on board
<FromGitter> <straight-shoota> it's really nice though to build interactive tutorials
<Papierkorb> it's nice as a multiline eval, where `crystal eval` falls apart
<RX14> no, playground is great
<RX14> but
<RX14> not neccesary for the first windows port
<FromGitter> <straight-shoota> yep
<FromGitter> <straight-shoota> I'm still having trouble with WSL crashing fairly regularly, so I'm back at working in a VM and didn't follow the latest progress in your windows branch
<Papierkorb> I found the cases where the crystal compiler in WSL could BSOD the host
<Papierkorb> hilarious. That's just soooo Windows
<RX14> hmm
<RX14> it worked
<FromGitter> <Dillybob1992> wsl has been working good for me and i will prob switch to windows port when finished though just bcz mahh windows. hell, i might re-install windows 7 and go back to that. really don't like windows 10
<FromGitter> <Dillybob1992> im only doing it bcz of crystal, imo 100% worth it
<Papierkorb> What, using windows? Nah
<FromGitter> <Dillybob1992> although, i just found out we can connect to virtual box through a bridged connection and use SSH. so iuno why i upgraded to W10, i guessbcz i wanted to try the WSL out. :O
<Papierkorb> You could've done that in a VM?
<RX14> well it runs
<RX14> but goddamn path handling messed it up
<Papierkorb> Barely any systems feature is worth the cost of switching, if you can just run it in a VM instead.
<RX14> especially with how cheap VMs are these days
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> at least on linux
<RX14> it's what, 5% overhead?
<Papierkorb> at most
<RX14> most of that is IO
<RX14> i'm running a qcow2 disk on btrfs so its not... snappy
<Papierkorb> I play video games in VMs with passed through PCI devices. Overhead is about 3-5%. Insane.
<RX14> my old desktop doesn't support IOMMU :(
<vegai> Papierkorb: what, really?
<vegai> holy crap
<RX14> and my laptop has no TB3 port for external GPU
<vegai> Papierkorb: what VM do you use?
<Papierkorb> Yeah, Battlefield4 capped out at 200FPS :(
<Papierkorb> vegai: bare QEMU, but most use KVM on top of that
<vegai> amazing :-o
<vegai> that requires some specific hardware support, does it?
<RX14> but doesn't QEMU run like shit?
<RX14> isn't QEMU without KVM basically just an emulator
<Papierkorb> And qcow2 too with virtio drivers in the guest. Didn't like that windows update, or waiting for it to update? Just kill the machine, rollback, done.
<RX14> hypervisors can't run in userspace can they?
<Papierkorb> RX14: Huh no one uses QEMU without KVM nowadays?
<RX14> <Papierkorb> vegai: bare QEMU, but most use KVM on top of that
<RX14> implied that you don't use KVM
<Papierkorb> KVM as in libvirt
<RX14> ...
<RX14> no libvirt is libvirt
<RX14> kvm is kvm
<Papierkorb> nice, that's not what people call it
<RX14> wtf
<RX14> I mean I use libvirt with virt-mmanager
<RX14> but i've never called it kvm
<RX14> wtf
<Papierkorb> no one says "libvirt host", it's always a "kvm host"
<RX14> well sure, because it is
<RX14> kvm is still running
<FromGitter> <Dillybob1992> rx14/others can u help me with a network question for my server
<RX14> and largely the most important part
<vegai> https://davidyat.es/2016/09/08/gpu-passthrough/ -- seems to require quite a bit of setup
<Papierkorb> vegai: It's not something I'd recommend to a linux newbie to put it that way
<RX14> also you need 2 GPUs
<RX14> and a compatible CPU
<Papierkorb> No biggie, iGPU
<RX14> and luck
<Papierkorb> Almost any gamer desktop computer has two GPUs nowadays
<vegai> yeah, I think I'll keep dualbooting for my legacy gaming needs :P
<vegai> interesting that that's possible though
<RX14> the main issue is that you have to dedicate monitors to the VM
<RX14> unless you use the new thing
<RX14> whatever they decided to name it
<Papierkorb> Huh? Monitors with multiple inputs?
<Papierkorb> Or a switcher?
<RX14> yeah but you can't like
<RX14> run the vm in a window
<Papierkorb> it's not as plug n play, no
<RX14> did you see you can run it in a window now Papierkorb
<RX14> with acceleration
<Papierkorb> Still worth it to me, cause screw windows
<RX14> and with 1 frame extra latency
<RX14> its cool
<Papierkorb> there are some projects doing stuff recently
<RX14> yeah
<Papierkorb> my setup predates that simply lul
<RX14> its nice we're at the point where you can just plug in a gpu and use a windows VM
<RX14> you need a little adapter that makes the gpu think there's a monitor attached
<RX14> but thats all
<Papierkorb> Meh
<RX14> if I had the harware that wouldn't be meh to me
<RX14> because my monitors are all 1 vga 1 dvi input
<FromGitter> <Dillybob1992> long story short: im using cloudflare for my master server, and cloudflare only protects against HTTP not TCP servers. so basically, if i open up my tcp server to port 9300 or w/e, the ip gonna be exposed. but i want my TCP server to be protected behind some kind of reverse proxy, so im not sure how what to do
<Papierkorb> Dillybob1992, did you ever run the server under the same domain without cloudflare?
<FromGitter> <Dillybob1992> nope, never
<Papierkorb> Point is, no one is out there to get you. There are a ton of bots to try the latest wordpress vulns on your page. But you'd have to actually give people an incentive so they'd target you, in which moment cloudflare doesn't really help you
<Papierkorb> Well, many hosters provide you with more than one IP address, don't you have an unused one?
<FromGitter> <Dillybob1992> i was thinking of that, the motive behind ddos. i guess i'd have to be a bad admin/tick someone off :O
<Papierkorb> DDoS is the only thing a CDN can protect against, but only against the stupid script kiddie
<Papierkorb> Which .. most of the ddosers are, so...
<FromGitter> <Dillybob1992> i don't have multiple ips yet, bcz im on a cheap yearly plan one. but what would i do if i had another 1?
codenoid has quit [Ping timeout: 260 seconds]
<Papierkorb> just use that other ip for services you don't want to be associated with your cloudflare'd presence
<Papierkorb> Might actually be expensive nowadays with v4's ran out, haven't checked in years
hightower2 has joined #crystal-lang
<FromGitter> <Dillybob1992> so when the user connects to master tcp server, use that ip instead?
<Papierkorb> You could check if you have a few million IPv6 otherwise
<Papierkorb> hosters gave them out like mad years ago
<FromGitter> <Dillybob1992> i see, thx for insight =]
hightower3 has quit [Ping timeout: 240 seconds]
<RX14> Papierkorb, ips are still cheap
<RX14> you can still get vpses for 2 euros/mo with an ipv4
<RX14> and extra ips usually run maybe 2.50 eur/mo
<RX14> ok so the compiler is weird on windows
<RX14> how is a syntax error thats only a syntax error on windows make sense?
<RX14> and it cant be line endings
<RX14> doesn't make sense https://my.mixtape.moe/rwvpxq.png
Ven`` has joined #crystal-lang
Raffy has joined #crystal-lang
Raffy has joined #crystal-lang
Raffy has quit [Changing host]
hightower has quit [Ping timeout: 268 seconds]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
Ven` has joined #crystal-lang
Ven`` has quit [Ping timeout: 248 seconds]
duane has joined #crystal-lang
<FromGitter> <straight-shoota> yay!
snsei has joined #crystal-lang
Raffy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <imonmyown> yoo-hoo!
Ven` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Raffy has joined #crystal-lang
Raffy has joined #crystal-lang
Ven`` has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
greengriminal has joined #crystal-lang
LastWhisper____ has joined #crystal-lang
LastWhisper____ has quit [Client Quit]
Ven`` has joined #crystal-lang
Raffy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
greengriminal has quit [Ping timeout: 256 seconds]
greengriminal has joined #crystal-lang
Ven`` has joined #crystal-lang
Raffy has joined #crystal-lang
Raffy has joined #crystal-lang
tankfeeder has left #crystal-lang [#crystal-lang]
<FromGitter> <j8r> I find the two syntax of declaring new typed variable more confusing than useful. Why having two syntax `
<FromGitter> <j8r> e.g. `Array of String` and `Array(String).new
cremes has joined #crystal-lang
<FromGitter> <j8r> `[] of String` actually
<FromGitter> <Dillybob1992> i like that one the most, my favourite
mark_66 has quit [Remote host closed the connection]
<FromGitter> <j8r> Can we do the equivalent of `Hash(String, Array(Int32) | String).new` for example?
Ven`` has quit [Ping timeout: 240 seconds]
<FromGitter> <j8r> The best will be sort of mix like `{String, [Int32] | String}` but everyone has his opinion, everyone can't be satisfied
<FromGitter> <j8r> And not sure that feasible. I like the `.new` syntax on my side
<Papierkorb> The "nice" type syntax is ambigous in some places, and thus would be the one to cede, if any
greengriminal has quit [Quit: Leaving]
greengriminal has joined #crystal-lang
Ven`` has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <PlayLights_twitter> Hey guys!, is there any way to check whether a class inherit from another? Like B < A => true on ruby (http://www.ruby-doc.org/core-1.9.3/Module.html#method-i-3C)
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb> In macro code, yes, in the same way
<Papierkorb> >> {{ String < Object }}
<FromGitter> <PlayLights_twitter> Thanks but I'm not using macro code, so im getting an `undefined macro variable` error, any other idea?
<Papierkorb> You'll have to use macros, but you can put that snippet there in any normal method
<Papierkorb> PlayLights_twitter, what're you doing? Want to figure out if something that was passed in inherits from something?
<FromGitter> <PlayLights_twitter> i have a class on a variable `handler.payload`and it can inherits from two different classes so I need to make a conditional for each inherit case
<FromGitter> <PlayLights_twitter> because later i use `handler.payload.new ` with different arguments on each case
<Papierkorb> I'd add a self.build method to the base classes, which then instantiate through `{{ @type }}.new(one, two, ...)`, while receiving the same set of arguments
<Papierkorb> That's both more powerful and cleaner
<FromGitter> <bew> Iirc you can just call new, without specifying the type and it'll work that way
<Papierkorb> bew, issue seems to be that the arguments differ
<RX14> @j8r yeah you can use Array(whatever).new
<RX14> and Hash().new
<RX14> I always use them instead of the ""nice"" syntax
<FromGitter> <PlayLights_twitter> @bew yes and that's why the compiler is raising the error, I just don't want to make array and ask if it includes the class because I will have to update the array every time I declare a new class
<FromGitter> <bew> Oh ok sorry
codenoid has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
<FromGitter> <asterite> to know if a class inherits another one use is_a?
<FromGitter> <asterite> Actually, it doesn't work very well...
<FromGitter> <PlayLights_twitter> Yep`is_a ` works fine for instances and not for classes
moei has joined #crystal-lang
codenoid has quit [Read error: Connection reset by peer]
<FromGitter> <asterite> It works for classes: A.is_a?(B.class)
<FromGitter> <asterite> but there's no A < B... yet. I think I have a solution, it's more of a hack because of how things work, but we could have it as a workaround until a better solution comes, if needed
codenoid has joined #crystal-lang
<RX14> we should just remove inheritance, to's too complex :)
<FromGitter> <imonmyown> rust has no inheritance and does pretty well without it :)
<Papierkorb> Rust is not OOP.
<Papierkorb> Crystal is.
<FromGitter> <imonmyown> yeah, I know
<Papierkorb> Or rather, a different interpretation of it.
<RX14> it's a lot more functional
<RX14> with ADTs
<FromGitter> <imonmyown> it would probably take too much effort to cut it out
<Papierkorb> For .. which gain?
<FromGitter> <imonmyown> exactly
<FromGitter> <asterite> Well, Rust has traits, like Go has interfaces. It's the new trend and I actually like it. Combined with reflection, it's probably the best thing to have
<Papierkorb> reflection is slow and makes it hard to know what's even going on
<Vexatos> Is it?
<Vexatos> That probably depends on your implementation of it
<Papierkorb> Doing a lookup is always slower than doing no lookup
<Vexatos> true.
<RX14> Vexatos, a function call is always static in crystal
<RX14> no vtables
<RX14> you can't get faster than that
<FromGitter> <imonmyown> RX14 that's not true
<Papierkorb> If Crystal would allow "implicit" includes of modules (which add no state to a function), we'd get the best part of traits.
<RX14> well, there are *kinda* vtables at the callsite
<RX14> with the dispatch based on class id
<RX14> but there are no C++ style vtables with indirection
<FromGitter> <imonmyown> not *kinda* vtables for real
<RX14> ?
<FromGitter> <imonmyown> there are trait objects that use vtables
<RX14> where are there traits in crystal?
<FromGitter> <imonmyown> my, I thought I saw rust there %)
<RX14> no I was talking about crystal
<FromGitter> <imonmyown> sorry!
<RX14> although modules are basically traits
<RX14> but more
<FromGitter> <asterite> except that all code is duplicated in implementations
<RX14> yeah
<RX14> which I honestly don't mind
<Papierkorb> While that may not required in all cases, for the general case, how else would it really work?
<RX14> vtables and methods not being templates
cremes has quit [Quit: cremes]
snsei has quit [Remote host closed the connection]
<RX14> i don't know how rust codegens all this
<Papierkorb> Code size isn't really that much of an issue anymore, even though it messes with the code cache
jokke has joined #crystal-lang
<jokke> hey
<RX14> but crystal does it in a dumb way and it works fantastically
<jokke> how can i pack primitives into slices?
<jokke> such as 32bit integers
<RX14> what do you mean?
<RX14> an example?
<jokke> i want to write raw 16bit audio samples to stdout
<RX14> what have you got and what do you need
<jokke> in big endian
<RX14> STDOUT.write_bytes(sample, IO::ByteFormat::BigEndian)
<jokke> i know there was some utility for this
<jokke> ah
<jokke> that was it
<jokke> thanks!
duane has joined #crystal-lang
<FromGitter> <PlayLights_twitter> @asterite You were right, that way works fine but looks like the compiler doesn't care about the conditional 😄 and stills throws an error, what is that hack? (I have solved using an array with the classes and using `includes?` method and I hate it)
snsei has joined #crystal-lang
<codenoid> hi all
codenoid has quit [Quit: Leaving]
<FromGitter> <asterite> a PR I'll send soon, using macro methods on both types
<FromGitter> <imonmyown> @codenoid hi
vivus has joined #crystal-lang
<FromGitter> <asterite> lol, I have a little crystal icon next to my name in the crystal reddit :-P
cremes has joined #crystal-lang
<FromGitter> <sdogruyol> ain't that super cool :)
cremes has quit [Quit: cremes]
cremes has joined #crystal-lang
<RX14> yeah
<RX14> I flaired everyone then oprypin edited the css to make it show as an icon
<RX14> it's super cool, thanks oprypin
<FromGitter> <sdogruyol> meanwile we're going strong in https://www.reddit.com/r/programming/ , don't forget to upvote 👍
cremes has quit [Quit: cremes]
Raffy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cremes has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Raffy has joined #crystal-lang
snsei has joined #crystal-lang
<crystal-gh> [crystal] woodruffw opened pull request #5644: init: Turn fork URL into a Markdown link (master...linkify-fork) https://git.io/vN1Bz
cremes has quit [Quit: cremes]
<FromGitter> <robacarp> Does Crystal have any project going that does code test coverage?
alex`` has quit [Quit: WeeChat 1.9]
<RX14> you can use kcov
<RX14> but its a bit broken because all the debug info is broken
cremes has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <watzon> Does anyone know what the `class << self` idiom does if you use it at the top of a module in Ruby?
<FromGitter> <watzon> Is it basically just the same thing as `extend self`?
<FromGitter> <robacarp> it makes everything inside that definition behave as if it were defined as `def self.method`
<FromGitter> <robacarp> I'm foggy on this but I think `extend self` only makes sense in modules, and has the effect of making all the `defs` into `module_function`s?
<FromGitter> <watzon> Right. Extend self basically makes your module like an instantiated class, so rather than having to type `def self.methodname` for everything you can just do `def methodname`, at least as far as I understand it
<FromGitter> <watzon> I wasn't able to find anything about using `class << self` in modules though
qard has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Poeticode is now known as ImoutoCodes
ImoutoCodes is now known as Poeticode
<FromGitter> <robacarp> I suppose it is similar in that sense
<FromGitter> <robacarp> This is a decent explanation I've read a time or two: https://stackoverflow.com/questions/2505067/class-self-idiom-in-ruby#2505077
Poeticode is now known as solidcode
solidcode is now known as Poetifox
snsei has joined #crystal-lang
<FromGitter> <imonmyown> some offtop here, guys can you please share your opinions on this article (https://hackernoon.com/biohack-your-intelligence-now-or-become-obsolete-97cdd15e395f)?
cremes has quit [Quit: cremes]
cremes has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cremes has quit [Quit: cremes]
Raffy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <codenoid> hi @imonmyown
<FromGitter> <codenoid> btw, can i use action cam with gphoto2 ?
<FromGitter> <xfbs> @imonmyown 1. everyone is already biohacking kinda anyways, think caffeine, nicotine. 2. watch out for the mdma stuff.. :p
<FromGitter> <imonmyown> @xfbs I feel really bad about it actually (fear and anger were stated by the author as most common reactions - I can admit some of that), however there's something else to that which I kinda find hard to word.
<FromGitter> <xfbs> You feel really bad about what?
paster34 has joined #crystal-lang
<FromGitter> <imonmyown> the suggested path for humanity as *envisioned* by the author
<paster34> hello! I looked through some crystal code on github. And then I found this code: https://pastebin.com/BneKUBhe what does that means?! you can use assembler in crystal?
<FromGitter> <codenoid> YEAH
<paster34> was that YEAH meaned to me?
<FromGitter> <bajro17> Yes
<FromGitter> <bajro17> or YEAH
<FromGitter> <bajro17> you can use it
<paster34> oh really? So you can really use assembler IN crystal?! I did not know that. Can I read more about that somewhere?
<paster34> i dont find anything about it in the docs
<paster34> or API
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <bajro17> I'm also beginner with crystal and I dont find so much good tutorials to learn
<oprypin> paster34, you can try searching "llvm inline assembly"
<FromGitter> <bajro17> than I plan to learn step by step and record videos and publish it on yt ot udemy
<paster34> crystal isnt really popular yet :/
<FromGitter> <xfbs> @imonmyown this article seems like it's either written by someone who is insane or someone who is on an excessive methamphetamine binge. I mean look at the length of it, and the quotes like ⏎ ⏎ > I want to be a god. ⏎ ⏎ > a 32-year old with no medical problems, I spent ~$200k on enhancing my health. Thousands of tests, medical teams, dozens of prescription drugs ...
greengriminal has joined #crystal-lang
<FromGitter> <imonmyown> @xfbs the problem is the guy is from Silicon Valley, which is like (I won't say trendsetter) very influential
<FromGitter> <bajro17> Laravel framework use this slogan "The PHP Framework For Web Artisans" but I think crystal is so beautiful language this is language for all programming artists
<RX14> paster34, it's not really documented since it's not really often needed
<RX14> it's basically the same syntax as C uses
<RX14> and the people who know ASM enough to use the asm literal likely also know the C syntax
DTZUZU has quit [Ping timeout: 246 seconds]
<paster34> oh yea but.. this is still really really interesting.. an assembler!
<paster34> not much languages have an inbuilt assembler
<FromGitter> <codenoid> yeah
<RX14> well llvm has one so it was just
<oprypin> cant come up with ny compiled language that doesnt have it
<RX14> idk
<RX14> maybe an hour to add it
<RX14> oprypin, technically go doesn't have an *inline* assembler
<oprypin> how would i know
<RX14> does that matter?
<RX14> you were talking about examples of compiled languages without assemblers
<FromGitter> <bajro17> I mostly programming in go but every time I come back to crystal
<RX14> I gave you an example
<oprypin> RX14, i was talking about examples that i know of :p but sure, thanks
<RX14> yeah I didn't mean to imply you should know that
<FromGitter> <bajro17> Thanks to all of you people who work on this programming language I love you all <3
<FromGitter> <xfbs> @imonmyown I mean I know there's a large community of people that spend vast resources on trying to do this kinds stuff.. LSD microdosing, antidepressants, etc. You might be familiar with the work of gwern who is a similar persona, albeit less crazy, from NYC. I'd just be wary of trying something with a, let's say <5% of harming you (any thing you do can harm you) to get a 1% improvement in perceived focus.. you
<FromGitter> ... know what I mean?
<FromGitter> <codenoid> yeah, crystal is my knowkcufocuo
<oprypin> xfbs, i am not comfortable with this topic
Raffy has joined #crystal-lang
Raffy has quit [Changing host]
Raffy has joined #crystal-lang
<FromGitter> <imonmyown> @oprypin, it was me who started this
<FromGitter> <xfbs> Ahh, sorry about that.
<FromGitter> <xfbs> Btw, I SO wish I was doing crystal right now. C++ iterators are so annoying :(
<FromGitter> <imonmyown> @xfbs, I sort of feel better now seeing the reaction (generally the absence of it) from the folks here.
DTZUZU has joined #crystal-lang
<FromGitter> <codenoid> @xfbs "i wish" ?, just install crystal and puts "helo"
<FromGitter> <codenoid> crystal will be your knowkcufocuo
<FromGitter> <codenoid> ohlol, `knowkcufocuo` makes me gigle
<FromGitter> <codenoid> Idk what that means
<FromGitter> <xfbs> Well i have this thing where I'm like solving project euler problems in all sorts of different languages. and now it's c++'s turn. tbh, crystal was the language that I enjoyed the most (out of C, ruby, rust, python, crystal). ruby's a little hard to optimize, I'm not a fan of python's syntax, C is.. well it's C. and rust is the fastest of all of them (for me) but it's also the most painful to use
<FromGitter> <xfbs> </spam>
<FromGitter> <asterite> He also says (referring to that article): "This section is also the reason I choose not to have children. None of us will disagree that children are extremely distracting, disrupt sleep for years; are generally a massive cost of time, focus and energy; and have material risks of not working out, for reasons outside our control. I just don’t see the ROI in children given my goal.". What a nice way to see
<FromGitter> ... kids/people: ROI.
<Papierkorb> xfbs, also using C++11 right now again. C++1x is pretty good, it barely gets enough credit imho. But writing code in Crystal's so much faster, and it runs about the same.
<FromGitter> <asterite> I guess he doesn't play either, or watch TV shows, because it's all just a waste of time... then I don't know what life is for to him, just getting smarter and smarter until he dies?
<Papierkorb> asterite, genius blackhole implosion. You need a really high IQ to understand this ~~play~~ life
<RX14> you can still think it's a bad ROI if you consider your experience and emotions with your children as return
<RX14> although thats a generous interpretation of what he said
<FromGitter> <xfbs> @Papierkorb I know you are on ##c++ (or at least were) *stalker*
<FromGitter> <xfbs> @asterite Could this be natural selection? Or maybe he doesn't have enough sex.
<FromGitter> <imonmyown> @asterite yeah he could some day watch Katsuhiro Otomo's Akira
<FromGitter> <imonmyown> and idk, see it a little differently
Raffy has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <codenoid> yeah, i always choose Knowledge-Building Over Wealth-Building
<FromGitter> <asterite> I think he has plenty of (varied) sex, from what he says in the article
<FromGitter> <codenoid> i have some story
<FromGitter> <codenoid> I just worked in a government company, and made an application using crystal, and who understands crystal just me, so when I came out (a week ago) then the workers there immediately learn crystal
<FromGitter> <asterite> he also seems to objectify women in that section, but I guess in crystal we all do (because of the "everything is an object")
<FromGitter> <xfbs> I think Experience >> Knowledge. Reading a book on cryptography is not quite the same as having implemented AES-256-ECB (although not used, since homegrown crypto is a bad idea)
qard has joined #crystal-lang
<RX14> i need to try more things
<RX14> I used to try lots of things in programming
<FromGitter> <xfbs> @asterite wait wait wait what was the bash joke again? `strip | finger | ...`?
<RX14> then I found crystal and i've basically stagnated since then
<FromGitter> <xfbs> @codenoid what are you working on at your company?
<RX14> I know so much about crystal and the problems that surround it but I should probably go and learn a new language again
<RX14> like I used to enjoy
<FromGitter> <xfbs> @RX14: as everyone sais, crystal is addictive. Not even once!
<FromGitter> <codenoid> something about software defined radio (SDR) @xfbs
<RX14> oh thats cool
<FromGitter> <xfbs> @codenoid tell me more, that actually sounds pretty cool. :)
<FromGitter> <codenoid> i play with usrp and Nuand board
<FromGitter> <codenoid> i need to sleep
qard has quit [Client Quit]
<FromGitter> <asterite> RX14: what language(s) are you considering trying out?
<RX14> nothing in specific
<FromGitter> <xfbs> @RX14: every played with OCaml?
<RX14> I should probably learn rust
<RX14> and maybe elixir or erlang
<FromGitter> <xfbs> Ohh if you come from crystal, rust will be so easy for you..
<RX14> perhaps
<RX14> I'm not used to thinking about ownershipo
<RX14> and patterns around it
<FromGitter> <imonmyown> couldn't bring myself to learning haskell, but it would probably the most life changing experiences
<FromGitter> <xfbs> ```[1, 2, 3, 4].map(|n| 2 * n).sum()``` [https://gitter.im/crystal-lang/crystal?at=5a6b9d554a6b0dd32b50964e]
<RX14> syntax is easy
<RX14> learning syntax? who cares
<RX14> learning semantics is what matters
<FromGitter> <xfbs> That's a hell of a lot nicer than C++.. I mean it doesn't even have a map
<RX14> rust with crystal's syntax would barely be easier than learning rust
<FromGitter> <asterite> Port ysbaddaden's gc to rust ;)
<RX14> heh
<FromGitter> <xfbs> and if it had, you'd use it like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a6b9db698927d57453eb87a]
<RX14> i was thinking about that
<FromGitter> <l3kn> @bajro17 Can you keep a list with some of the things / concepts you find hard to understand? I'm trying to write a short tutorial on building a raytracer in crystal but I can't remember the things I found complicated when I first got into it
<RX14> I think it would be cool if crystal's gc was in rust
<RX14> but practically asking people to install 2 toolchains to work on crystal...
<RX14> not a good idea
<oprypin> D:
<Papierkorb> There's already a boehm port for rust
<RX14> boehm isn't immix though
<Papierkorb> I'm still waiting on real world showcases
<RX14> I think that the moust "out of my zone" thing for me right now is 3d graphics
<RX14> Papierkorb, there have been
<RX14> ysbaddaden just prefers to talk in the manas slack for some reason
<RX14> instead of gitter
<Papierkorb> The biggest thing is that boehm is only conservative
<RX14> a compiler with the new GC can compile itself
<RX14> so the GC works on a complex application
<RX14> and some time ago the allocator benchmark was really fast too
<FromGitter> <Dillybob1992> ok so i did some fiddling around on a tcp server on this vps. i opened around 5k connections to the server, and memory went to around 30mb usage. however i disconnected them all, and memory still at 30mb usage. is that normal?how long does it take for the memory go down?
<FromGitter> <asterite> @l3kn did you continue using crystal? and what do you think about it?
<oprypin> Dillybob1992, it's not about time, it's more like when memory usage gets critical then it clears up
<oprypin> also (this is conjecture) the process does not necessarily have to release the memory, it could hold onto it
<FromGitter> <Dillybob1992> ohh ok
<RX14> @Dillybob1992 memory for fibers should halve every 5 seconds
<RX14> and the amount of GC memory a crystal application uses never decreases
paster34 has quit [Ping timeout: 260 seconds]
<FromGitter> <Dillybob1992> wait really
<FromGitter> <Dillybob1992> so the memory is "recycled" if you will
<RX14> yeah boehm is not... ideal in many ways
<RX14> @Dillybob1992 if you use 20mb of memory, crystal will always own that 20mb of memory
<RX14> but most of it will be "free to use" if you stop using it
<FromGitter> <Dillybob1992> i see i see. interesting
<RX14> it's reusable by crystal
<RX14> but never the OS
<RX14> there's a gc compile option to make it return memory
<RX14> but it's not on by default
<FromGitter> <xfbs> Well, if you're on a sensible OS, it'll just page out whatever memory crystal isn't using and make it available for other applications
<FromGitter> <xfbs> Or like on OS X, when an app doesn't use some memory, first the OS compresses it and then when it's bored it'll page it out or whatever
<FromGitter> <Dillybob1992> but wait, what if for example, i have characters logging in and they have a bunch of RPG data (character stats), and when they log off (their class gets deleted from main array, no references to it). their memory will affect the global pool still?
<RX14> pagefiles are bad :)
<FromGitter> <Dillybob1992> but wait, it doesn't matter bcz it'll get re-used
<FromGitter> <Dillybob1992> ohh i see.. yeah
<RX14> @Dillybob1992 yep
<FromGitter> <Dillybob1992> WOW i get it now
<RX14> all it ever affects is if you have multiple things on the same VM
<RX14> it just means crystal always uses it's *peak* memory consumption
<FromGitter> <Dillybob1992> well, what happens when you get 1000 characters online, peaked memory usage to lets say 300mb. then 800 players logged off. now still 300mb usage. i better get a dedicated server eh
<RX14> well
<RX14> if you consider you had to handle the peak memory usage of 300mb
<RX14> anyway
<RX14> it makes no difference
<RX14> if you peak at 300mb, you still have to have a server that has 300mb of ram
<RX14> regardless of this or not
<FromGitter> <Dillybob1992> yeah, true.. vps hosts prob don't boehgm gc tha tmuch eh
<FromGitter> <Dillybob1992> hahahah
<FromGitter> <xfbs> Well, you need a server that has 300MB < (RAM + SWAP)
<FromGitter> <Dillybob1992> don't like*
<RX14> which is hopefully all of them these days
<FromGitter> <l3kn> @asterite I spent the last few months in an elixir / rust rabbit hole, but I'll get back into it. I really like the language and have yet to find something with a better "fun programming" to performance ratio
<RX14> @Dillybob1992 no, you using more or less ram doesn't make any dofference to the provider
<FromGitter> <xfbs> also, there's an option somewhere to check how much memory your application is actually using.. as in, not how much it has malloc/mmap'ed, but how much is actually paged in
<FromGitter> <Dillybob1992> o really?
<RX14> if you have 500mb of ram in your VPS, it's *always* using 500mb of ram
<RX14> thats how VMs work
<FromGitter> <xfbs> Is it tho? I think the host can page in/out that memory too, can't it?
<RX14> yeah but that doesn't matter
<FromGitter> <Dillybob1992> i see. so the usage isn't a big deal unless you exceed the limit (well ya can't)
<RX14> yep
<FromGitter> <Dillybob1992> so basically, amount of ram plays in a ratio of how many players server can sustain. good to know then
<FromGitter> <Dillybob1992> need good overhead i guess
<FromGitter> <Dillybob1992> just in case
<RX14> yeah 500mb ram isn't a lot these days
<RX14> 2gb ram is like
<RX14> the minimum
<RX14> for vpses
<RX14> unless you use somewhere expensive like digitalocean
<FromGitter> <Dillybob1992> true dat. did i tell u got this 6$ yearly one, it has 512mb and 512 swap?
<RX14> ouch, thats cheap
<RX14> there's cheap then there's *too cheap*
<FromGitter> <Dillybob1992> im tsting bunch of crystal stuff on it now. doing simply "crystal run" takes 2min, compared to 3 seconds on my i7 2600 lol
<FromGitter> <Dillybob1992> the vps is soo slow lmao
<Papierkorb> That's not because of RAM, but because you barely get any CPU shares on that box
<RX14> it could be cause of ram Papierkorb
<RX14> if it's swapping hard
<FromGitter> <Dillybob1992> but it works and re-boots are fast/reinstalls are quick and im fiddling around with linx environment i guess its worth it
<RX14> but likely the CPU
<Papierkorb> Yes, but USD6 basically begs for that
<RX14> 6$/mo gets you a lot of VPS
<Papierkorb> If you want to fiddle with linux boxes, spin up virtual machines on your desktop computer
<RX14> 6$/yr gets you nothing worth the money
<FromGitter> <Dillybob1992> @RX14
<Papierkorb> Pro tip, after installing the system in the VM, take a snapshot so you can recover later when you wrecked it lul
<FromGitter> <Dillybob1992> lol
<RX14> @Dillybob1992 1 core I presume
<RX14> and you'll see this thing in `htop` called "steal"
<Papierkorb> Dillybob1992, the host CPU in the VPS may be good or bad, but the hypervisor can (and will) restrict how much CPU time you actually get
<FromGitter> <xfbs> Make an account on vultr.com, you can rent a 4GB RAM VN with a 60GB SSD for 3ct/hr
<RX14> and it'll be high
<RX14> I honestly recommend for cheap reliable VMs ovh
<Papierkorb> xfbs, that's expensive for toying around where running everything on your desktop computer would do fine
<RX14> and cheap unreliable VMs, scaleway
<FromGitter> <Dillybob1992> yeah, i mean it was marketed as a "vCPU" too, but it's w/e it's getting the job done. plus i like to have a real server cuz i can test latency lag with game dev stuff helps with lerp functions for smooth character movement, lag compensation stuff, etc
<FromGitter> <MrSorcus> Hi all. ⏎ How to write `fun` in binding if function in C can be "Node or constant" ⏎ For example: ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5a6ba2f16117191e61b92ff8]
<RX14> but as Papierkorb said, if you can do it in a local VM, do it in a local VM
<RX14> servers are useful for hosting
<RX14> and ocationally when you need 12 cores and 64gb of ram for an hour
<Papierkorb> Dillybob1992, there are tools that let you simulate lag locally
<FromGitter> <Dillybob1992> i agree and i just found out that i can connect to virtual box with SSH.. which ironically if ound out day after i bought it -.- im
<Papierkorb> Of course you can?
<Papierkorb> And you can buy VirtualBox?
<RX14> @MrSorcus `NO_PARENT` is an integer 0, but parent is a Node so they're just incompatible types
<FromGitter> <Dillybob1992> bought the vps* i mean hehe
<FromGitter> <bew> @MrSorcus use `NO_PARENT = nil`, or just pass nol to the fun call (instead of using a lib constant)
<FromGitter> <Dillybob1992> @Papierkorb i will look into the lag simulation stuff as well, thnk you
<FromGitter> <MrSorcus> > **<RX14>** @MrSorcus `NO_PARENT` is an integer 0, but parent is a Node so they're just incompatible types ⏎ ⏎ I understand this, but in `C` i can use this constant... *confused*
<RX14> C is a lot more weakly typed than crystal
<RX14> NULL in C is just "0"
<Papierkorb> Crystal allows for much less implicit conversions than C
<RX14> whereas in Crystal it HAS to be "nil"
<FromGitter> <bew> Or `Pointer(Test::Node).null` for completeness
snsei has quit []
<FromGitter> <bew> But not sure I would recommand using that instead of nil
<FromGitter> <MrSorcus> Ok, Thanks so much for explanation. :-)
<RX14> honestly though Papierkorb
<RX14> at 6/yr he's probably paid for the year already
<Papierkorb> Yeah I mean for 6 a year you get nothing much, but more than nothing
<FromGitter> <Dillybob1992> @RX14 so when people say a "custom gc" for crystal might be written, that would mean the memory would get removed after cleaned up? or just act differently in ways outside of my knowledge?
<RX14> it could be one of the features implemented - yes
<RX14> mainly the aim is to be faster and have less latency
<RX14> or be more robust
<Papierkorb> And please give me hooks
<FromGitter> <Dillybob1992> is there a positive for the memory to still be there like that? faster creation of objects or something?
<FromGitter> <Dillybob1992> does it have pros/cons?
<RX14> compacting memory and being able to unmap blocks is...
<RX14> a feature
<RX14> but fairly low pri
<RX14> i presume
<RX14> well compacting is very important and hard to get right
<FromGitter> <bew> I'm studying Computer Architecture & Operating System at university, it's sooooo much interesting, I wish I could use Crystal for everything :p
<Papierkorb> Compacting is nigh impossible in Crystal in the general case
<FromGitter> <xfbs> @bew you study in Paris?
<RX14> Papierkorb, well it is once you have a precise GC
<FromGitter> <bew> @xfbs Normally yes, but this year (4th) I'm in California 2 semesters
<FromGitter> <Dillybob1992> in the godot engine, ( i know this is a very bad example ), but this is how i thought crystal worked cuz iuno i'm dumb, lol. anyway: they use something like a "reference counter" and i guess that's how i thought crystal did too bcz of the "everything is an object" if no object is referenced, it's freed (removed from counter). that's what i think made me think of why memory was still there
<Papierkorb> Crystal doesn't use reference counting
<RX14> @Dillybob1992 reference counting is one kind of GC
<RX14> it's a very simple way to implement GC
<RX14> and it has advantages and tradeoffs with other kinds of GC
<RX14> but non-reference-counting GC is generally considered faster these days
<FromGitter> <xfbs> @bew Oh nice, how's california treating you?
<FromGitter> <Dillybob1992> i see, which coincides good with fast language i assume
<FromGitter> <bew> @xfbs it's awesome!! It's my first time there, I whish I never come back ˆˆ
<FromGitter> <Dillybob1992> i just bought this ear endoscope thing from amazon, can't wait to try it out
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <MrSorcus> C: ⏎ ⏎ ```void open_file(FILE *fp)``` ⏎ ⏎ How to write `fun` function for this? Which type must be here? Thanks. [https://gitter.im/crystal-lang/crystal?at=5a6ba78a6117191e61b94961]
<FromGitter> <Dillybob1992> tons of ear wax from headphone usage over the years, can't hear nething
greengriminal has joined #crystal-lang
<FromGitter> <bajro17> @l3kn I can I will try describe everything what I find hard
<FromGitter> <xfbs> @bew Haha I see, but eh, Paris isn't so bad either, I spent new years there this year :)
<FromGitter> <xfbs> @Dillybob1992 why? :D
<FromGitter> <Dillybob1992> iuno, bored :P
<Papierkorb> MrSorcus, if you don't know the structure of FILE (You probably don't in this case), you can just pass a Void* instead. You can also put `alias File = Void` into your `lib`, and then write `fun open_file(fp : File*)`
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <bew> Papierkorb you forgot a star somewhere
alex`` has quit [Ping timeout: 256 seconds]
<FromGitter> <MrSorcus> I ⏎ ⏎ > **<Papierkorb>** @MrSorcus, if you don't know the structure of FILE (You probably don't in this case), you can just pass a Void* instead. You can also put `alias File = Void` into your `lib`, and then write `fun open_file(fp : File*)` ⏎ ⏎ Ok, but how to open file? With File.open it doesn't work `undefined method 'to_unsafe' for File` ... [https://gitte
<FromGitter> ... r.im/crystal-lang/crystal?at=5a6bb4575a9ebe4f75dcea66]
<oprypin> :(
<FromGitter> <MrSorcus> I feel myself stupid X-)
<crystal-gh> [crystal] asterite opened pull request #5645: Class: add comparison operators (master...feature/class-comparison) https://git.io/vN1AU
<crystal-gh> [crystal] asterite opened pull request #5646: Spec: implement `be_a` and `expect_raises` without macros (master...refactor/spec-dont-use-macros) https://git.io/vN1Ai
<FromGitter> <asterite> RX14 about compacting GC, what about object_id? The memory address will change, but the object_id shouldn't change...
<RX14> oh, fair enough
<RX14> uhh
<RX14> well
<FromGitter> <asterite> Yeah, `object_id` is a PITA
<RX14> thats a bridge we'll cross when we come to it
<RX14> we could just remove it
<RX14> define equality on pointerof(self)
<FromGitter> <asterite> Probably yes
<RX14> and all other equality is by `#hash`
<RX14> or whatever
<RX14> yeah removing it is fine
<RX14> oh but `#hash` will change
<RX14> because that uses `object_id`
<RX14> that's far more of an issue
<FromGitter> <asterite> yes, `hash` has the same issue
<RX14> @asterite i meant that you can have an `else` clause in the `begin`/`end`
<FromGitter> <asterite> actually, maybe not. it could still be the reference
<RX14> the only reason we have `failed` variable is to skip that raise
<FromGitter> <asterite> yes, but there's a `fail` inside the `begin` that we need to ignore
<RX14> move it to the else
<RX14> as i suggested...
<RX14> and then it's not in the begin
<FromGitter> <asterite> ooooooh...
<RX14> yeahhh
<RX14> then you remove the variable
<RX14> and the complexity
<RX14> and (if the parser recognises `else` on a method body (doubt)) wou could remove the begin/end
<RX14> and just have the rescue, rescue, else clauses on the method itself
<FromGitter> <asterite> Done!
<FromGitter> <asterite> Oh, yeah, we could remove the `begin` too
<FromGitter> <asterite> let me try
<RX14> @asterite ex_to_s can be removed in the second rescue
<RX14> because it's only used on one place
<FromGitter> <asterite> Done too
<RX14> also `map` and `join` can be replace by `join` with block
<RX14> if you care about those few ns on a failing spec :)
<FromGitter> <asterite> Well, it's shorter so better
aroaminggeek has joined #crystal-lang
<RX14> funilly enough I tried to do this a week ago
<RX14> but I presumed that you couldn't just stick a type parameter into a rescue restruction
<RX14> without trying it
<RX14> and realised why it was a macro in the first place
<RX14> rescue restriction*
<FromGitter> <asterite> yes, it might be that we didn't have that feature at that time
<FromGitter> <asterite> In fact, now after the other PR we could just remove that and rescue a generic exception and use `<=`, if we really wanted to