ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | 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
avdi_ has joined #crystal-lang
manveru_ has joined #crystal-lang
foca_ has joined #crystal-lang
davic has quit [*.net *.split]
avdi has quit [*.net *.split]
manveru has quit [*.net *.split]
foca has quit [*.net *.split]
t0nyandre has quit [*.net *.split]
Majost has quit [*.net *.split]
aarongodin has quit [*.net *.split]
ssvb has quit [*.net *.split]
oz has quit [*.net *.split]
avdi_ is now known as avdi
badeball has joined #crystal-lang
cyberarm has joined #crystal-lang
txdv has joined #crystal-lang
thews has joined #crystal-lang
salvor has joined #crystal-lang
davic has joined #crystal-lang
FromGitter has quit [Ping timeout: 260 seconds]
FromGitter has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
byteflame has quit [Ping timeout: 245 seconds]
betofloresbaca[m has quit [Ping timeout: 245 seconds]
fifr[m] has quit [Ping timeout: 255 seconds]
kp666[m] has quit [Ping timeout: 260 seconds]
braidn[m] has quit [Ping timeout: 260 seconds]
olbat[m] has quit [Ping timeout: 260 seconds]
cptaffe has quit [Ping timeout: 260 seconds]
Renich has quit [Ping timeout: 260 seconds]
thunker[m] has quit [Ping timeout: 276 seconds]
gloscombe has quit [Quit: WeeChat 2.0.1]
olbat[m] has joined #crystal-lang
return0e has joined #crystal-lang
heaven31415_ has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
byteflame has joined #crystal-lang
fifr[m] has joined #crystal-lang
kp666[m] has joined #crystal-lang
betofloresbaca[m has joined #crystal-lang
Renich has joined #crystal-lang
cptaffe has joined #crystal-lang
thunker[m] has joined #crystal-lang
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
DTZUZU has quit [Ping timeout: 256 seconds]
yxhuvud has joined #crystal-lang
oz has joined #crystal-lang
ssvb has joined #crystal-lang
aarongodin has joined #crystal-lang
Majost has joined #crystal-lang
t0nyandre has joined #crystal-lang
braidn[m] has joined #crystal-lang
braidn[m] has joined #crystal-lang
braidn[m] has quit [Changing host]
DTZUZU has joined #crystal-lang
Renich has quit [Ping timeout: 256 seconds]
braidn[m] has quit [Ping timeout: 246 seconds]
olbat[m] has quit [Ping timeout: 240 seconds]
kp666[m] has quit [Ping timeout: 255 seconds]
byteflame has quit [Ping timeout: 255 seconds]
betofloresbaca[m has quit [Ping timeout: 260 seconds]
thunker[m] has quit [Ping timeout: 256 seconds]
fifr[m] has quit [Ping timeout: 260 seconds]
cptaffe has quit [Ping timeout: 260 seconds]
qard has joined #crystal-lang
olbat[m] has joined #crystal-lang
cptaffe has joined #crystal-lang
betofloresbaca[m has joined #crystal-lang
byteflame has joined #crystal-lang
thunker[m] has joined #crystal-lang
braidn[m] has joined #crystal-lang
Renich has joined #crystal-lang
kp666[m] has joined #crystal-lang
fifr[m] has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
That_Guy_Anon1 has joined #crystal-lang
That_Guy_Anon has quit [Ping timeout: 252 seconds]
<FromGitter> <girng> hello everyone. just curious what's the status of the windows support by chance?
<FromGitter> <girng> i also have a question about crystal being used for game servers, can i ask it here?
<FromGitter> <bew> 'sure you can ask here
<FromGitter> <Blacksmoke16> anyone here use Kemal?
<FromGitter> <Blacksmoke16> have a question but not sure if it is Kemal specific or, core crystal
<FromGitter> <Blacksmoke16> i was hoping to use the document comments on my routes, to make the body of requests and what endpoints do etc, however it only seems to work for methods :/
<FromGitter> <girng> @bew thanks. i'm creating an aRPG similar to Diablo 2. i want to use 1 crystal instance on each VPS. to be used as game servers. they will have a tick rate of 14 or 24hz. and handle monster ai and relay player movement to the connected clients in that game. (6 players per game). the problem is, i don't know how many game instances i can have per 1 crystal instance using that kind of tickrate (game loop). ⏎
<FromGitter> ... ⏎ i was looking into `loop do` and `spawn`. should i use multiple of these to run multiple game loops? or just one game loop on the server, and manage the games/players inside of it?
qard has joined #crystal-lang
<FromGitter> <bew> looking at the problem, I'd say one fiber per game loop, and one fiber per client connection
<FromGitter> <bew> if you want a good (quite complete) introduction to using fibers, I recommend reading https://crystal-lang.org/docs/guides/concurrency.html
<FromGitter> <girng> i'll see what I can do. i saw the TCP example, and it's really nice / super simple to setup. just more confused about where to do the game loop
<FromGitter> <bew> hmm and maybe a fiber per tcp server (one per game), so that you can have the game loop in its own fiber running while there is no IO requests
<FromGitter> <girng> cool @bew , bless your heart. thanks for support!
<FromGitter> <bararchy> @Blacksmoke16 Kemal has it's own gitter channel
<FromGitter> <bararchy> if it's specific you should ask there
<FromGitter> <bararchy> https://gitter.im/sdogruyol/kemal
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
<FromGitter> <bararchy> Loking here: https://github.com/Kriegslustig/rust-portscanner/blob/master/src/main.rs#L64-L77 dosn't Rust have a `.to_i` function ?
<FromGitter> <bararchy> @girng look here also: https://stackoverflow.com/a/30854065
yxhuvud has joined #crystal-lang
yxhuvud has quit [Client Quit]
<FromGitter> <girng> nice, yeah that helps
yxhuvud has joined #crystal-lang
<FromGitter> <girng> also, i have a large set of json that gets exported from my database (items). loading it into crystal should be done via CSV, or just doing a JSON map? or would the performance be negligible? i was just kind of worried of all the redundant keys in the json file
<FromGitter> <girng> i would really like a global variable so i can access the items anywhere in code, is that possible? for example Items[5].name
<FromGitter> <girng> or would I have to use a module or whatever, and then do moduleName.Items[5].name ?
<FromGitter> <girng> i could always just make the module name super short and just do `g.Items[5].name` i guess
<FromGitter> <faustinoaq> ^ Interesting
<FromGitter> <faustinoaq> 😄
<FromGitter> <unn4m3d> 😄
<FromGitter> <girng> i have to say. crystal works quite nice on WSL. im loving it
<FromGitter> <bew> Nice one @faustinoaq, I agree ;)
<FromGitter> <bararchy> Crystal is young, it doesn't have strong back like Go, or huge corporate validation like Java, or millions of libs like C/C++ or huge community like NodeJS/JavaScript. But , Crystal is sooo fun to write in, the syntax and mindset are pure pleasure, and there is so much I love about the way it implement stuff, concurrency model is easy and clear, low level bindings are simple and straightforward, OOP all around
<FromGitter> <bararchy> And the community though small is really good ;)
<txdv> obviously, because the community consists only of entusiasts
That_Guy_Anon1 has quit [Quit: Leaving]
<FromGitter> <bararchy> True :)
<txdv> what about windows? when is crystal comming for windows?
rohitpaulk has joined #crystal-lang
Ven`` has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <girng> i decided to just use WSL im very happy w/ it.
<FromGitter> <girng> gives me a reason to use Windows 10 😄
qard has joined #crystal-lang
<txdv> WSL is a blessing
qard has quit [Ping timeout: 255 seconds]
<FromGitter> <girng> +1
<txdv> Windows become a window manager for me with the introduction of wsl
<txdv> ;)
<FromGitter> <girng> Crystal + WSL = Heaven
That_Guy_Anon has joined #crystal-lang
ishahnaz has joined #crystal-lang
<FromGitter> <bararchy> @girng is that the Godot engine icon ?
<FromGitter> <girng> yeah
<FromGitter> <girng> but, i changed the eyes lol
<FromGitter> <bararchy> Oh right hahah
<FromGitter> <girng> you a godot fan too? i love the engine!
<FromGitter> <girng> works nice with crystal!
<FromGitter> <bararchy> Does it? Didn't know it has Crystal support? How is that working ?
<FromGitter> <girng> ha, i mean the networking part. godot can connect to a crystal tcp server and communicate really easily!
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
<FromGitter> <bararchy> Oh, yeha in that regard :)
<livcd> wsl is not the answer what if i want to deploy to windows :-|
<FromGitter> <girng> @bararchy look, it seems like the godot developers want to follow what crystal-lang does, and want their own scripting language (gdscript) to compile to bytecode https://github.com/godotengine/godot/issues/17846
<FromGitter> <girng> out of curiosity,is that how crystal lang was created? ('im noob in that regard')
<oprypin> girng, try to avoid global variables. you're gonna get race conditions, don't you know?
<oprypin> this is the job of a database
<FromGitter> <girng> ik global variables bad, but i wanted a global namespace to references to my Items that gets loaded from a file, itwould be nice to use `Items[5].name` anyway. not sure how to do that though
<FromGitter> <bararchy> @girng the official story behind Crystal is @waj and @asterite wanted to create a faster ruby that compiles to native executables without a need for VM/runtime
<livcd> i really wonder if truffle takes off before Crystal gets popular
<FromGitter> <girng> @bararchy ty, friend
<FromGitter> <girng> what is truffle? candy?
rohitpaulk has quit [Ping timeout: 276 seconds]
<FromGitter> <bararchy> @girng you know what will be a cool project? Game server framework in Crystal, that will allow you to spin up a GS in an hour
<FromGitter> <girng> agreed.
rohitpaulk has joined #crystal-lang
<FromGitter> <girng> @livcd is this what u r talking about? https://github.com/trufflesuite/truffle
ishahnaz has quit []
<FromGitter> <strigonLeader> Hi I'm just trying out crystal for the first time having a bit of trouble with nilable types
<FromGitter> <bararchy> @strigonLeader what's your issue ?
<FromGitter> <strigonLeader> I want to forward declare a variable as a nilable UNIXStream and then only execute code when its not nil but the compiler failrs
<FromGitter> <strigonLeader> give me a sec I'll post a gist
ishahnaz has joined #crystal-lang
<FromGitter> <strigonLeader> I tried unless server.nil? before but I saw code like this somewhere in the crystal source so I tried this as well but I get a compilation failure with "undefined method 'close' for Nil"
<FromGitter> <alex-lairan> Try with this: ⏎ ⏎ ``` s.close(delete: true)``` [https://gitter.im/crystal-lang/crystal?at=5abdf984c574b1aa3e4b326b]
<FromGitter> <strigonLeader> didn't work
<FromGitter> <strigonLeader> I got server to be a Nil | UNIXServer now
<FromGitter> <strigonLeader> by going ⏎ ⏎ ```server = nil.as(Nil | UNIXServer)``` [https://gitter.im/crystal-lang/crystal?at=5abdfa2f92f5d62057769aca]
<FromGitter> <strigonLeader> which isn't too cool
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <strigonLeader> oh wait no nevermind
<FromGitter> <strigonLeader> that all works
<FromGitter> <strigonLeader> ok
<FromGitter> <alex-lairan> But, why do you want your server nullable?
<FromGitter> <strigonLeader> I want to register the at_exit callback before I create the socket
<FromGitter> <strigonLeader> basically I just want it to always delete the file if it can
<FromGitter> <strigonLeader> for example when I send an interrupt
<FromGitter> <strigonLeader> so now it looks like this ⏎ https://gist.github.com/strigonLeader/4b9a521ab0b09efffbc2c3923d73c676
ishahnaz has quit [Ping timeout: 256 seconds]
elia has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <strigonLeader> @alex-lairan so it looks like its just the interaction of the block that's causing the compiler to act this way, I can use the .nil? syntax outside without a local variable. Is this for concurrency reasons?
elia has quit [Quit: (IRC Client: textualapp.com)]
ishahnaz has joined #crystal-lang
ishahnaz has quit [Client Quit]
ishahnaz has joined #crystal-lang
That_Guy_Anon has quit [Remote host closed the connection]
That_Guy_Anon has joined #crystal-lang
<FromGitter> <petoem> @strigonLeader you can do `if s = server` instead of `unless (s = server).nil?`
<FromGitter> <strigonLeader> Ok I got it now, once I put the variable into the block the compiler rescopes the variable to a concurrency sensitive scope and you have to always cache the value immediately after checking what it's type is.
<FromGitter> <petoem> and on line 1: `server = nil` should be enough
<FromGitter> <petoem> at_exit registers a `Proc`
<FromGitter> <petoem> this means it has closure data
<FromGitter> <petoem> this is why you have to do `s = server`, server could change anytime
<FromGitter> <strigonLeader> yeah
<FromGitter> <strigonLeader> thanks for the help!
Ven` has joined #crystal-lang
Ven`` has quit [Ping timeout: 256 seconds]
ishahnaz has quit []
<FromGitter> <girng> @livcd what's the difference between that and crystal?
<FromGitter> <girng> which one is faster
ishahnaz has joined #crystal-lang
<FromGitter> <r00ster91> Is it a bug that ⏎ ⏎ ```INPUT = gets ⏎ puts INPUT``` ⏎ ⏎ then it lets me enter something! [https://gitter.im/crystal-lang/crystal?at=5abe0d2f5f188ccc151190ff]
<FromGitter> <alex-lairan> @girng truffleruby is a ruby implementation, the have the same syntaxe. ⏎ ⏎ Crystal has is own implementation, with cool types ! :D
<FromGitter> <alex-lairan> And Crystal don't need Java environement
<FromGitter> <girng> @alex-lairan thx. i like crystal more then 😆
<FromGitter> <unn4m3d> > You don't need a JVM to run TruffleRuby. With the SubstrateVM it is possible to produce a single, statically linked native binary executable version of TruffleRuby, which doesn't need any JVM to run
<oprypin> r00ster91, it may be arguable, but this is expected behavior. constants that are never used are never initialized. this is a constant. and you certainly shouldn't put such dynamically computed results in a constant
rohitpaulk has joined #crystal-lang
<oprypin> you also get no control over when this code gets executed
Ven` has quit [Ping timeout: 255 seconds]
<FromGitter> <r00ster91> ah okay thanks
<FromGitter> <girng> i can see real world benchmarks with kemal, can't find any with truffleruby (regarding tcp / websocket servers)
<FromGitter> <girng> so unfortunately will pass on mah truffleruby
<FromGitter> <girng> seems relly cool though.
Ven`` has joined #crystal-lang
<FromGitter> <girng> wow, crystal has a 29.63 second lead in truffle in the brainf*ck test
<livcd> meaningless benchmarks
<FromGitter> <girng> so i could use truffleruby, and just install the `ruby` socket gem and i will get performance increases over regular ruby?
<FromGitter> <girng> seems like magic, if it's too good to be true, it prob is where is the hidden penality?
<livcd> the trick is it does not support C extensions afaik. They are working on it
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <girng> i see
Papierkorb has joined #crystal-lang
Ven`` has quit [Read error: Connection reset by peer]
Ven`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> livcd which mean no messgepack , XML, zip , etc.. Unless written in pure ruby
Papierkorb has left #crystal-lang ["Konversation terminated!"]
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <girng> something that i've noticed is the gitter community here is really special. because i visited the gitter couple months ago but didn't say anything (bcz wasn't sure i was going to use crystal). however it's always been very active and if anyone has a problem theres always someone to help. like instantly it seemed. it's hard to find that in communities tbh.
Ven`` has joined #crystal-lang
Ven`` has quit [Client Quit]
manveru_ is now known as manveru
<FromGitter> <alex-lairan> In the french ruby comunity, we have a slack named ParisRB, lots of channels with help and discutions about ruby :)
<FromGitter> <alex-lairan> 700 active members :3
<FromGitter> <girng> dang :D
heaven31415 has joined #crystal-lang
ishahnaz has quit []
<FromGitter> <Blacksmoke16> perfect thanks @bararchy
<FromGitter> <girng> i was curious, is bidirectional communication between the client and the server, would JSON be ok?
<FromGitter> <girng> i see crystal has `to_json`?
<oprypin> json is pretty inefficient. you can use a custom protocol or at least a memory efficient common protocol (msgpack) or crystal-specific cannon
<FromGitter> <girng> would calling `to_json` before every `socket.write_bytes` bad for performance?
<FromGitter> <girng> oh wow let me check out msgpack i heard of that before
heaven31415 has quit [Ping timeout: 268 seconds]
<FromGitter> <girng> can you elaborate more on "crystal-specific" cannon?
<oprypin> actually nervermind because you have non-crystal on one side
<FromGitter> <girng> oh yah. godot lol
<FromGitter> <girng> that's why i was thinking of doing the json stuff. becaues the godot engine has built in json, but calling `to_json` before every `socket.write_bytes` looks like it will be kinda hard on the server. especially if it's going to be used in a game loop (14 or 24hz tickrate).
<FromGitter> <girng> maybe i should do a crystal specific cannon way that works with godot or a custom protocol? not entirely sure
Ven`` has joined #crystal-lang
alex`` has quit [Ping timeout: 256 seconds]
<FromGitter> <faustinoaq> Hi community, I'm the maintainer of amber-aur: https://aur.archlinux.org/packages/amber/ ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ ^ Does somebody know how to remove this warnings? [https://gitter.im/crystal-lang/crystal?at=5abe355492f5d62057779e8e]
<FromGitter> <faustinoaq> ^ Repo: https://github.com/amberframework/amber-aur
alex`` has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
<FromGitter> <j8r> @faustinoaq are you shipping a pre-built dynamically-linked executable?
<FromGitter> <j8r> hum no it seems not
<FromGitter> <faustinoaq> No, still compiling it from source 😅
<FromGitter> <j8r> it's better to do this way when we use a package manager
<FromGitter> <j8r> don't know :) I see the `--production` added to `shards install` - what it adds?
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
heaven31415 has joined #crystal-lang
duane has joined #crystal-lang
hightower3 has joined #crystal-lang
<FromGitter> <faustinoaq> Is to avoid installing `development_dependencies` like ameba, see: https://github.com/amberframework/amber/blob/master/shard.yml#L68
hightower2 has quit [Ping timeout: 268 seconds]
<FromGitter> <j8r> ok, good to know!
<FromGitter> <paulcsmith> I'm trying to figure out how to remove an element from an array in a constant but I can't figure it out. There is no `reject!` and I can't re-assign a constant so I'm not sure how to do this: https://play.crystal-lang.org/#/r/3sqh
Ven`` has joined #crystal-lang
<FromGitter> <paulcsmith> Any ideas? It's for this feature https://github.com/luckyframework/lucky/issues/398 maybe that extra context helps
<dom96> lol, is every crystal developer writing a web framework?
<FromGitter> <girng> not me, i'm writing game server :D
<FromGitter> <Blacksmoke16> web app :)
<FromGitter> <paulcsmith> Ha right after I posted I thought of something. Not as ideal, but I added another `UNEXPOSED` constant and when I need to get just the exposed methods I do `EXPOSURES.reject { |exposed| UNEXPOSED.includes?(exposed) }`
ashirase has joined #crystal-lang
<oprypin> faustinoaq, u should move those to makedepends
<oprypin> faustinoaq, btw what's the point of having just the amber binary?
<FromGitter> <faustinoaq> Ok, oprypin thank you 👍 "what's the point of having just the amber binary?", What do you mean?
<FromGitter> <faustinoaq> Hi dom96 :)
<FromGitter> <faustinoaq> dom96 Yeah, looks like many crystal devs come from a rails/ruby background 😅
<FromGitter> <girng> my background is html 😄
<FromGitter> <faustinoaq> lol
<FromGitter> <faustinoaq> dom96, in fact there is almost 17 web framework for crystal https://crystal.libhunt.com/categories/5128-web-frameworks
<FromGitter> <faustinoaq> although, The three most popular are Kemal, Amber and Lucky
<RX14> dom96, it probably comes from ruby's popularity largely coming from rails
<RX14> I wish people would stop trying to reinvent rails though :(
<RX14> rails isn't a particularly good framework design
<RX14> it's a good framework because of it's maturity but thats not ebcause of it's design
<heaven31415> what kind of framework is designed nicely in your opinion?
<FromGitter> <j8r> personally i think a server API + a client (web or not) is the good way to go. A web framework by essence combine both, i don't know if there is a framework exclusively for APIs (like for REST)?
<RX14> heaven31415, getting rid of controllers and going for just routes as functions
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> making models far less magic
<FromGitter> <paulcsmith> That's similar to Lucky's approach. But the routes are classes
<oprypin> ...
<FromGitter> <paulcsmith> Each route is its own class instead of one class handling multiple routes
<FromGitter> <paulcsmith> ...
<RX14> I'd probably go look at all the frameworks of all the other languages and see what I like about them
<FromGitter> <paulcsmith> Make it much easier to have type safety because you're not mixing so many actions together. I found when mixing a bunch of routes into one class you end up having a lot of `not_nil!` because things are only used for some actions
<RX14> I get the feeling that a lot of crystal web frameworks are made by people who have m,ainly used rails
<RX14> why would you need ivars in a route anyway?
<RX14> it makes no sense
<RX14> a route is a function from request to response
<RX14> the template should be a function from params to HTML
<oprypin> faustinoaq, what's the purpose of duplicating AUR's git repo at https://github.com/amberframework/amber-aur ?
<FromGitter> <paulcsmith> You don't need them in Lucky because it is just a class. But I do use private methods a lot
<RX14> yeah I guess
<FromGitter> <paulcsmith> It's nice for extracting nicely named methods rather than intermediate local vars
<RX14> the ORM is the main complexity point of most frameworks
<RX14> and copying anything but activerecord is best there
<RX14> @paulcsmith until you need the method in more than one route
<RX14> I guess actually helper modules + include works well there
<RX14> hmm
<FromGitter> <paulcsmith> I include a module or extract a class I can use
<FromGitter> <paulcsmith> Yeah
<RX14> do you document thatr apttern?
<FromGitter> <paulcsmith> Yep, this section: https://luckyframework.org/guides/actions-and-routing/#using-pipes specifically "Sharing pipes with modules"
<FromGitter> <paulcsmith> Those examples use `before` but you can of course just use a module with regular old methods if you want.
<FromGitter> <paulcsmith> As an example, for authentication I include a `RequireSignIn` module.
<RX14> I guess I should read docs
<RX14> see what I can complain about for lucky :)
<RX14> oh yeah
<RX14> that
<FromGitter> <paulcsmith> You can use Lucky by including the shard, but I don't think that will be it's main use-case so I haven't documented it
<RX14> installing anything on my system makes me super annoyed
<RX14> I don't want to install anything on my system to use a dependency for 1 project
<FromGitter> <paulcsmith> That's fine, Lucky may not be for you then
<oprypin> RX14, well that's a bit of a strong stand
<RX14> yeah it is
<RX14> but if you consider how easy it is to do without
<FromGitter> <paulcsmith> Every web app I've written requires those deps so I'm fine requiring them. If it is a problem then it likely isn't for you
<RX14> i.e. install shard and then compile a binary at ../../bin
<RX14> or use the new shards thing when it comes
<FromGitter> <paulcsmith> Yeah that part might change. The rest almost certainly won't. The yarn/npm stuff will change once we add a `--api` option
<FromGitter> <bararchy> dom96 were doing cyber security and machine learning, diploid guys do genetic analysis etc.. Crystal isn't just web
<RX14> installing a commandline tool locally to a project is fine
<RX14> installing something globally is just wrong
<RX14> especially if you end up maintaining between multiple major versions of lucky
<RX14> if that happens
<RX14> because then you need 2 generators for the different incompatable templates
<RX14> and fuck that
<FromGitter> <paulcsmith> Lucky CLI was built to be compatible with multiple Lucky versions
<RX14> having it project-local solves that
<FromGitter> <paulcsmith> The generators and most Lucky tasks are local to the project. The only thing the CLI does is run the tasks and generate a Lucky project (and a few other built in tasks)
<FromGitter> <bararchy> Some ppl do Kernel work, and I saw anything from networking to databases etc..
<FromGitter> <bararchy> Take a look at awsome crystal
<RX14> @paulcsmith so it has even less reason to exist :)
<FromGitter> <paulcsmith> I agree having to change the CLI for different projects would be annoying. The CLI avoids that problem unless I make some massive changes to how tasks work
<RX14> alias lucky='bin/lucky'
<RX14> binary replaced
<FromGitter> <paulcsmith> It has 2 main reasons to exist: It is easier to discover tasks, it runs non-precompiled tasks (like migrations) and it generates Lucky projects
<RX14> generating a lucky project could be just crystal init, add to shards, bin/lucky init
<FromGitter> <paulcsmith> Technically you can do most of that without the Lucky CLI it's just more annoying. Most people would rather install the binary and generate projects. Phoenix initially took the approach of generating a stock Elixir app, then adding phoenix, then running a generator and people really didn't like it
<RX14> shards add if/when that happens
<FromGitter> <paulcsmith> Yeah maybe that'd be fine
<RX14> I'd design for the future not now
<FromGitter> <paulcsmith> I'll have to play around with it
<RX14> yeah
<RX14> I hope that it can be avoided
<FromGitter> <paulcsmith> Or maybe make some commits to the shards repo to make tasks more discoverable. Or make it an option for people who don't want to use the global CLI. Everythinig *can* be done withuot it (except for initializing the project, but I could change that)
<RX14> if at the end of the day you keep lucky cli for "lucky init"
<RX14> but provide the 3-command install as equally placed in the docs
<RX14> and otherwise bin/lucky is the full thing
<RX14> then that would be fine for me
<FromGitter> <paulcsmith> Yeah I could get behind that
<RX14> lucky would basically be a bin/lucky alias except for the project generator
<FromGitter> <paulcsmith> Global Lucky for those that prefer it, local bin for those that prefer that. It shouldn't require much change actually. I'll work on that once the shards PR is merged
<FromGitter> <paulcsmith> Add the Lucky shard and bin/lucky init, just like you said
<FromGitter> <paulcsmith> Actually, maybe you're right and I can just use `bin/lucky` and ignore the global stuff. I'll play around with that...
<RX14> presumably it's be less work to make global lucky just delegate to bin/lucky?
<FromGitter> <paulcsmith> Thanks for talking this through
<RX14> np
<FromGitter> <paulcsmith> Yeah I think you're right
<FromGitter> <paulcsmith> Once the shards thing is merged there might not be much reason for the global install. And it would definitely be easier than maintaining a homebrew tap!
<RX14> yeah
<FromGitter> <paulcsmith> And like you said, I could suggest people add a `lucky` alias so it looks "global" if they don't want to type `bin/lucky`
<FromGitter> <paulcsmith> I'm digging this...
<RX14> actually
<FromGitter> <paulcsmith> Would be even awesomer if you could so `shards add luckyframework/lucky` but hey it's not a big deal to open up shards and add a few lines :)
<RX14> @paulcsmith you could replace global lucky with a bash function lola
<RX14> lol*
<RX14> which just checked if it was lucky init
<FromGitter> <paulcsmith> I'm not sure I understand? I think the `alias` would work and be a bit easier
<RX14> if it was it'd just run crystal init, shards add, bin/lucky init
<RX14> else it was just an alias
<FromGitter> <paulcsmith> Ohh I see
<RX14> i'm actually not sure thats a good idea
<RX14> you'd end up parsing args in bash to seperate the arguments nor crystal init and lucky init
<RX14> and that'd get too long for a one-liner
<RX14> and then blegh
<FromGitter> <paulcsmith> Yeah I agree. But if there was shards add I could let people copy paste the command `crystal init app_name && shards add lucky_cli && shards build && lucky init`
<RX14> lucky() { [ "$1" == "init" ] && (crystal init "$@"; cd "${@[-1}
<RX14> lucky() { [ "$1" == "init" ] && (crystal init "$@"; cd "${@[-1]}; shards add lucky; bin/lucky init "$@") || bin/lucky "$@" }
<FromGitter> <paulcsmith> Or maybe I can give people a command that adds the correct dep to shards.yml so they can copy paste project setup
<FromGitter> <paulcsmith> Thanks. I'll add that to a gist and give that a try once I've started work on this
<RX14> it's a dumb idea
<RX14> because as I said you'll want lucky init to have args
<RX14> and a --help
<RX14> and then the function gets long
<RX14> and then it's more effort than its worth
<FromGitter> <paulcsmith> Yeah that makes sense
<FromGitter> <faustinoaq> > what's the purpose of duplicating AUR's git repo at ⏎ ⏎ oprypin, is just to maintain the PKGBUILD 😅
<FromGitter> <faustinoaq> Well, I guess is not needed since aur already has a version control system integrated 😅
alex`` has quit [Ping timeout: 260 seconds]
rohitpaulk has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
<FromGitter> <faultyserver> does anyone have any ideas/opinions on testing macros?
<FromGitter> <faultyserver> there's obviously the basic "does it still compile" testing, but I kind of want a stronger harness around some macros I've written
Groogy2 has joined #crystal-lang
<oprypin> faultyserver, it's not a crazy concept but i'm pretty sure it hasn't been done
<FromGitter> <faultyserver> The best idea I've come up with only really works for macros that generate methods, wherein you call the macro a few times at the beginning of the file, then test the resulting methods.
<FromGitter> <faultyserver> It's rather ugly, though :/
<oprypin> the right approach would be to test what the macro actually outputs
<FromGitter> <faultyserver> yeah, I can agree with that for the most part
<oprypin> faultyserver, not looking good so far https://carc.in/#/r/3sqw
<FromGitter> <faultyserver> for reference, my use case here is a macro that takes some "flag" arguments to determine what to generate. I want to make sure that combinations of those flags are always valid and *semantically* correct
<oprypin> certainly
<FromGitter> <faultyserver> I'll try to mess around with it for a bit. I think I have an idea that may at least suit my specific case
<oprypin> this is so hard
<oprypin> faultyserver, im looking at https://github.com/waterlink/expand.cr
<FromGitter> <faultyserver> hmmm, that looks useful
<RX14> just test the output lol
<FromGitter> <faultyserver> the buffer output or the resulting code as if there was no macro?
<FromGitter> <faultyserver> I don't particularly want to test the buffer output cause I don't want to have to re-write my tests if I refactor the macro at some point
<FromGitter> <faultyserver> I'm aiming more for the latter
<FromGitter> <faultyserver> the only struggle is making it not look horrendous
<oprypin> wtf does it want?
<oprypin> $ crystal tool expand lib.cr
<oprypin> Usage: crystal tool expand [options] [programfile] [--] [arguments]
<FromGitter> <faultyserver> an empty `--` ?
<FromGitter> <faultyserver> maybe
<RX14> you do crystal tool expand src/myapp.cr -c src/my/current/file.cr:line:col
<RX14> in case file.cr doesn't require on it's own
<oprypin> i dont get it
<oprypin> i just want to print the resulting source
<RX14> the tool is designed to print the macro expansion under the cursor
<RX14> it only goes one deep
<RX14> you can't dump all source
<RX14> you specify en entrypoint file and where the cursor is
<RX14> it's not that hard
<RX14> looks right to me??
<oprypin> RX14, is not scalable
<RX14> its not designed for what you want it to do
<oprypin> it should be
<RX14> but it should work
<RX14> i don't see why you don't just test the generated code
<RX14> it's what the stdlibdoes and it works fine
<FromGitter> <faultyserver> for my own benefit can you link to an example of where it does that? I'd like to see it
<oprypin> RX14, macro tests are a thing
<FromGitter> <faultyserver> cool, thanks
<FromGitter> <faultyserver> that's what I'm aiming for
alex`` has joined #crystal-lang
t0nyandre is now known as t0nyaway
alex`` has quit [Quit: WeeChat 2.1]
<heaven31415> if I write def foo(arg) ... end, it is basically a template for methods which will be instantiated every time a new type bounds to arg, right?
<RX14> yes
<heaven31415> and generics use the same mechanism?
<RX14> yes
alex`` has joined #crystal-lang
<heaven31415> that is cool
<RX14> until you realise that it makes compile times explode :)
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/vxo8p
<crystal-gh> crystal/master f33a910 Carl Hörberg: Enqueue senders in Channel#close (#5880)...
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 256 seconds]
<travis-ci> crystal-lang/crystal#f33a910 (master - Enqueue senders in Channel#close (#5880)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/360383408
<DeBot> https://github.com/crystal-lang/crystal/pull/5880 (Enqueue senders in Channel#close)
rohitpaulk has quit [Ping timeout: 248 seconds]
return0e has joined #crystal-lang
return0e_ has quit [Ping timeout: 256 seconds]
return0e has quit [Ping timeout: 260 seconds]
<heaven31415> but if I use type-restriction everywhere I won't pay price?
<oprypin> heaven31415, it makes no difference in that regard. it depends on how many different types pass through the function. obviously if you make a very strict type restriction it will make only one type be able to pass, so it indirectly helps
greengriminal has joined #crystal-lang
greenbigfrog has quit [Ping timeout: 245 seconds]
commavir has quit [Ping timeout: 245 seconds]
greengriminal has quit [Quit: Leaving]
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
return0e has joined #crystal-lang
commavir has joined #crystal-lang
greenbigfrog has joined #crystal-lang
heaven31415 has quit [Ping timeout: 256 seconds]
duane has quit [Ping timeout: 260 seconds]
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 260 seconds]
alex`` has quit [Ping timeout: 276 seconds]
<FromGitter> <Blacksmoke16> say i have a class in a module
<FromGitter> <bew> Where do you want that?
<FromGitter> <Blacksmoke16> just as a string
duane has joined #crystal-lang
<FromGitter> <Blacksmoke16> wondering if there is a nice way to do that vs doing regex on the module::name::class string
<oprypin> wut
<FromGitter> <bew> Just find the last `:` and take everything after it
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <Blacksmoke16> `self.class.to_s.split("::").last`
<oprypin> Blacksmoke16, please refrain from major edits. we dont see them. https://bpaste.net/show/48d8f6cdddb8
<FromGitter> <bew> that's very inefficient
<FromGitter> <Blacksmoke16> major edits of what?
<FromGitter> <Blacksmoke16> i didnt edit anything?
<FromGitter> <Blacksmoke16> yea im not a fan, ill just hardcode it
<FromGitter> <Blacksmoke16> tl;dr i put my granite models into a module for organization/documentation, but it caused it to inherrit the module + class name (which is used as the table name) so it was using wrong table name, was trying to be clever and have it just pull table name from class name
<FromGitter> <bew> @Blacksmoke16 https://carc.in/#/r/3ssi
<FromGitter> <Blacksmoke16> but would be more work than it is worth (due to pluralization and stuff)
<FromGitter> <Blacksmoke16> oo that sslick
<oprypin> Blacksmoke16, https://crystal-lang.org/api/0.24.2/String.html#partition%28search%3AChar%7CString%29%3ATuple%28String%2CString%2CString%29-instance-method
<oprypin> actually https://crystal-lang.org/api/0.24.2/String.html#rpartition%28search%3AChar%7CString%29%3ATuple%28String%2CString%2CString%29-instance-method
<oprypin> class.name.rpartition("::").last
<oprypin> slightly less efficient but worth the simplification
<FromGitter> <bew> Oh nice!
<FromGitter> <Blacksmoke16> also slick, thanks!
<crystal-gh> [crystal] RX14 closed pull request #5883: Allow a path to declare a constant (master...allow-path-to-declare-constant) https://git.io/vxVqB
tt_ has joined #crystal-lang
tt_ has quit [Client Quit]
<FromGitter> <Blacksmoke16> if you have a JSON.mapping, does that mean the only way to initialize a new object is with JSON?
<RX14> no
<RX14> you can define a normal constructor
heaven31415 has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://carc.in/#/r/3ssm
<RX14> ...that doesn't work without JSON>mapping either
<RX14> you have to define the constructor yourself
<FromGitter> <Blacksmoke16> ohh right, sorry
<FromGitter> <Blacksmoke16> that would do it
<RX14> just def initialize(@type_id, @type_name)
<RX14> should do
<FromGitter> <Blacksmoke16> the issue was when setup like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5abec07e270d7d370878c184]
<FromGitter> <Blacksmoke16> without the mapping it works fine
<FromGitter> <Blacksmoke16> assuming since with mapping its looking for the initializer but it doesnt exist persya
<FromGitter> <Blacksmoke16> yea had to add the initializer with the mapping, might be a granite bug?
<RX14> yes
<RX14> I have no idea how granite operates lol
<RX14> looks like their bug
<FromGitter> <faustinoaq> Hi @Blacksmoke16 , what editor are you using for coding crystal?, intellij-idea?
<FromGitter> <faustinoaq> 😅
<FromGitter> <Blacksmoke16> ill file a bug ^
<FromGitter> <Blacksmoke16> Rubymine with https://github.com/intellij-crystal/intellij-crystal plugin
<FromGitter> <Blacksmoke16> just provides syntax highlighting atm but is better than nothing
<FromGitter> <faustinoaq> Oh, yeah very nice 👍
<travis-ci> crystal-lang/crystal#5cd78fa (master - Allow a path to declare a constant (#5883)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/360463310
<FromGitter> <Blacksmoke16> prob could mess with it and apply Ruby code completion to .cr files since most are similar
<DeBot> https://github.com/crystal-lang/crystal/pull/5883 (Allow a path to declare a constant)
<FromGitter> <faustinoaq> About the granite issue, didn't you open a PR fixing that?
<FromGitter> <faustinoaq> wait, no... you PR was about the import thing :)
<FromGitter> <faustinoaq> Maybe we need to open a new issue in the granite repo, @drujensen WDYT?
<FromGitter> <Blacksmoke16> im writing one now
<FromGitter> <faustinoaq> Oh nice 👏 ✨
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <faustinoaq> About the intellij-idea crystal plugin, His creator told me, he already created other plugins for intelli-idea, so he would be very happy to contribute more with the crystal plugin once crystal is stable. ⏎ ⏎ I created a fork here: https://github.com/crystal-lang-tools/intellij-crystal-lang
<FromGitter> <faustinoaq> > once crystal is stable. ⏎ ⏎ Mainly because He had bad experiences maintaining non-stable languages, so many breaking changes is hard to maintain 😅
<RX14> @faustinoaq crystal language is pretty stable lol
<RX14> because we don't have anyone who works on the compiler much any more lol
<FromGitter> <faustinoaq> Well, I guess He read crystal's README ⏎ ⏎ > The project is in alpha stage: we are still tweaking the language and standard library. ⏎ ⏎ ^^ [https://gitter.im/crystal-lang/crystal?at=5abec4c1e3d0b1ff2c86a88e]
<FromGitter> <faustinoaq> Should we remove that line from the REAME?
<RX14> no
<FromGitter> <faustinoaq> ^ https://github.com/crystal-lang/crystal/blame/master/README.md#L38 ⏎ ⏎ Ok, no problem then :)
<RX14> I was making a joke that the lack of language changes is largely circumstantail (since ary left)
<FromGitter> <faustinoaq> Oh, I don't notice that 😟
<FromGitter> <faustinoaq> I mean about he left
<RX14> well
<RX14> ary's here when he wants to be
<RX14> which is aparrently not very often
<FromGitter> <faustinoaq> Well, I guess he is still likes crystal, maybe we can see him in the future 😉 ⏎ ⏎ I really like how Elixir creator talks with their community, ⏎ ⏎ José Valin is a very nice person [https://gitter.im/crystal-lang/crystal?at=5abec6d2e4ff28713a907fef]
<RX14> lol i'm not so sure he likes crystal's design much any more
<FromGitter> <faustinoaq> ^ I really love how NeuralLegion and diploid are using crystal on production
<FromGitter> <faustinoaq> RX14 Well, crystal's community love it :)
<RX14> yeah
<RX14> I love crystal
<RX14> even though it's a shambles with an uncertain future
<FromGitter> <faustinoaq> RX14, what about https://crystal-lang.org/2017/12/19/this-is-not-a-new-years-resolution.html, Didn't you feel trusted enough with this? I think Manas is a nice company :)
<RX14> oh of course manas is a nice company
<RX14> but growing crystal 10x larger than it currently is is an absolutely monumental task
<RX14> there's a good chance that despite everyone's best efforts crystal never reaches escape velocity and isn't maintained in 5 years
<FromGitter> <PlayLights_twitter> Hey maybe you know this, when a crystal executable crash is really bad because i need to start it manually again, how do you deal with this
<FromGitter> <Blacksmoke16> @faustinoaq pushed a new commit for the bulk-import pr :)
<heaven31415> ary was the only compiler dev?
<FromGitter> <faustinoaq> Oh Thank you so much! 👍 ⏎ ⏎ BTW, about the intellij crystal plugin, Can you try scry using a LSP client? https://github.com/gtache/intellij-lsp
<FromGitter> <faustinoaq> I'm just curious if you can get completion, go to definition, and symbol listing out-the-box with scry 😄
<FromGitter> <Blacksmoke16> lets fine out
<RX14> heaven31415, he wrote most of the code - yes
<FromGitter> <faustinoaq> heaven31415, definitely no, there is RX14, ysbaddaden , sija, makenowjust, straigh-shoota and other awesome contributors to the compiler core
<FromGitter> <faustinoaq> RX14, Oh:(
<RX14> I don't do compiler work lol
<RX14> I basically only touch the stdlib
<FromGitter> <faustinoaq> My bad, What about waj?
<RX14> too busy
<FromGitter> <faustinoaq> Oh I see
<RX14> rarely if ever responds to pings
<FromGitter> <Blacksmoke16> @faustinoaq how do i use this? what does it mean by `Then setup scry binary path on your LSP client. ⏎ `
<FromGitter> <faustinoaq> So, Are we basically, fixing issues and bringing compatibility to new platforms?
<RX14> I'm sorry to be a bit depressing but if you think that the future of crystal is in any way certain you probably need to dial back your expectations
<RX14> although all that means is we have to work hard on crystal's future
<FromGitter> <faustinoaq> RX14 I hope to see bcardiff and Manas team talking about the crystal future, I'm very optimistic, though
<RX14> @faustinoaq honestly no new compiler features isn't a bad thing
<FromGitter> <faustinoaq> Yeah, I agree
<RX14> there's enough bug fixes
<heaven31415> well, they can talk
<RX14> and enough new features and stuff to do in the stdlib
<RX14> if I really wanted to go deep into the compiler I could probably work it out
<RX14> @bew recently did his first few compiler PRs
<RX14> hopefully it wasn't too hard
<heaven31415> but hypothetically speaking, in your opinion, what are the most important things to do right now? windows and parallelism support?
<RX14> parallelism will break everything
<RX14> and windows will get us more users
<RX14> so yes
<RX14> oh, and making method args cast to their restrictions
<RX14> which wouldn't be a terrible change
<RX14> in terms of usability
<heaven31415> so you can pass UInt16 into UInt32 argument?
<RX14> and would vastly affect compile times
<RX14> no
<RX14> this is more restrictive
<RX14> this isn't conversion
<RX14> this is .as casting
<RX14> you can't do 1.as(UInt8)
<RX14> it fails to compile
<FromGitter> <faustinoaq> > To add a supported language server, you can either create a plugin (see intellij-lsp-dotty) which extends this plugin and extend LanguageServerDefinition or instantiate a concrete subclass of it and register it, or simply go to ⏎ ⏎ https://github.com/gtache/intellij-lsp#add-a-language-server ⏎ ⏎ ^ @Blacksmoke16 Seems that using LSP and scry on Intellij-idea is not as easy as I though 😅
<FromGitter> <faustinoaq> We'll need to create a client plugin first, like `intellij-lsp-crystal`
<RX14> This is about `class Foo; end; class Bar < Foo; end; def foo(bar : Array(Foo)); end` then previously you could do `foo(Array(Bar).new)`
<RX14> this would match type type restriction
<RX14> but generate a foo(Array(Bar)) method
<RX14> and a foo(Array(Foo)) method
<FromGitter> <faustinoaq> So, you can't use scry yet, sorry for the expectation
<RX14> duplicating the method
<RX14> that makes compile times slow
<RX14> the change would be to disallow that and always cast arguments to their types
<RX14> for example if you had foo(bar : Int32 | String)
<RX14> currently foo(1) will generate a foo(Int32) method which only takes ints
<RX14> which is much faster at runtime because the method only has to take integers
<RX14> and LLVM can do a lot more optimizations
<FromGitter> <Blacksmoke16> yea would be very helpful if i could just install it like any other plugin
<RX14> but at compile time there's 3 methods that could be generated
<RX14> foo(Int32) foo(String) or foo(Int32 | String)
<FromGitter> <faustinoaq> RX14, What about this (https://gitter.im/crystal-lang/crystal?at=5ab0150635dd17022e79c5fe)? :)
<RX14> casting to arg type would mean that there was always only foo(Int32 | String)
<RX14> and when you pass in an int it's like
<RX14> foo(1.as(Int32 | String))
<RX14> @faustinoaq i'm not going to work on that
<RX14> it'd be cool but plenty of compiled languages live without a repl
<RX14> it'd be cool if crystal got a workable repl
<heaven31415> but we better work on windows support
<heaven31415> how is it going btw XD?
<FromGitter> <faustinoaq> RX14, Yeah, no problem, I know that, is just a nice idea to keep around :)
<RX14> slowly
<RX14> bug @ysbaddaden to review my PRs lol
<FromGitter> <Blacksmoke16> @faustinoaq seems i had to install LSP support plugin to get that section in settings
<FromGitter> <faustinoaq> Yeah, I just realize about that
qard has joined #crystal-lang
<FromGitter> <Blacksmoke16> executable -> extension: cr path: path/to/built/crystal/program any args?
<FromGitter> <faustinoaq> https://youtrack.jetbrains.com/issue/IDEABKL-7409 ⏎ ⏎ ^ @Blacksmoke16 I just found this thread
<FromGitter> <faustinoaq> ^ Seems you can try this: https://plugins.jetbrains.com/plugin/10209-lsp-support
<FromGitter> <faustinoaq> Just specify the scry path, I mean something lije /home/my-user/Downloads/scry-executable
<FromGitter> <Blacksmoke16> yea thats what im using
duane has quit [Ping timeout: 256 seconds]
<FromGitter> <faustinoaq> Oh nice ⏎ ⏎ > executable -> extension: cr path: path/to/built/crystal/program any args? ⏎ ⏎ Yeah, any args, the LSP client and scry server should work out-the-box [https://gitter.im/crystal-lang/crystal?at=5abecf5327c509a774c00d05]
duane has joined #crystal-lang