RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.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
<FromGitter> <Sija> @Groogy `->{}.class # => Proc(Nil)` if that’s what u mean
<FromGitter> <Sija> `->{ return "foo" }.class # => Proc(String)`
akaiiro has joined #crystal-lang
DTZUZO has quit [Ping timeout: 272 seconds]
<Groogy> Yeah I was wondering if return "foo" would make a return in the method I declare the Proc or if it does a return in the Proc
<Groogy> since you also have break "foo"
<Groogy> for blocks
<FromGitter> <girng> whats the diff between proc and a method?
ashirase has quit [Ping timeout: 244 seconds]
ashirase has joined #crystal-lang
<woodruffw> from my understanding: procs are objects, methods are syntax-level constructs
zorp has quit [Ping timeout: 252 seconds]
gtramontina has joined #crystal-lang
gtramontina has quit [Remote host closed the connection]
zorp has joined #crystal-lang
zorp_ has joined #crystal-lang
zorp has quit [Ping timeout: 272 seconds]
gtramontina has joined #crystal-lang
gtramontina has quit [Remote host closed the connection]
gtramontina has joined #crystal-lang
gtramontina has quit [Remote host closed the connection]
gtramontina has joined #crystal-lang
gtramontina has quit [Remote host closed the connection]
gtramontina has joined #crystal-lang
gtramontina has quit [Remote host closed the connection]
gtramontina has joined #crystal-lang
zorp_ has quit [Ping timeout: 244 seconds]
DTZUZO has joined #crystal-lang
gtramontina has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
DTZUZO has quit [Ping timeout: 252 seconds]
pabs has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
<atna> I *think* Procs are closures which can encapsulate data from the context they were written in, and realised as objects with a call method. So a = 12; some_func(->(x) { a * 32 }) will create something like (in pseudocode) object { @a = 12; call(x): @a * x }. But the @a value won't actually be copied, it'll be a reference to the real a.
<FromGitter> <DanielSokil> Could someone please guide me what I'm doing wrong? ⏎ Error: `Error in 100_doors.cr:7: undefined method '[]=' for NamedTuple(door: Int32.class, open: Bool.class)` ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b85087058a3797aa3c90211]
<FromGitter> <DanielSokil> It says in docs you can create: ⏎ ⏎ ```# An array of named tuples of x: Int32, y: String ⏎ Array({x: Int32, y: String})``` ⏎ ⏎ But how to assign to it? [https://gitter.im/crystal-lang/crystal?at=5b85091c9c71d363c13d998f]
<FromGitter> <DanielSokil> Ah, tuples are immutable.
<FromGitter> <talbergs> You got me really puzzled there
<FromGitter> <talbergs> do we have a way to get cureent method? Such ar we can get line at `__LINE__`?
Raimondii has joined #crystal-lang
<FromGitter> <bew> @talbergs yes kind-of: `{{@def.name.stringify}}`
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
ashirase has quit [Ping timeout: 244 seconds]
<FromGitter> <bew> @DanielSokil yes tuple and namedtuple are immutable
<FromGitter> <bew> You can use a struct or a class instead
ashirase has joined #crystal-lang
<FromGitter> <talbergs> Thanx @bew
Groogy has quit [Ping timeout: 268 seconds]
Groogy has joined #crystal-lang
pabs has joined #crystal-lang
<FromGitter> <talbergs> Can't find, do we have a way to use a shard from some local dirrectory?
alex`` has quit [Quit: WeeChat 2.2]
<FromGitter> <vladfaust> @talbergs ⏎ ⏎ ```myshard: ⏎ path: ../myshard``` [https://gitter.im/crystal-lang/crystal?at=5b852182f86b741b05d3f5f0]
<FromGitter> <talbergs> thanx. I tinkered withs symlinks, but compailer complained. Maybe it looks at shards.lock file, i guess
<FromGitter> <talbergs> @vladfaust how to require it like this: `require "myshard"`? It only works for me this way now `require "myshard/src/sum.cr"`
<FromGitter> <talbergs> I even added ⏎ ⏎ ```targets: ⏎ crystal-dgraph: ⏎ main: src/dgraph.cr``` ⏎ ⏎ into symlinked shards yml, no luck. [https://gitter.im/crystal-lang/crystal?at=5b852664ff445156164c43d6]
<FromGitter> <vladfaust> It should work just as like you've installed a shard from external location
<FromGitter> <talbergs> hmm, maybe the OS again is issue, (osx)
<FromGitter> <diegogub_gitlab> hi guys, I keep having issues with DNS into docker and crystal. I saw all the github issues, and seems to be resolved..but still I can't make it work. Someone has any idea how could I do a work around? Docker is running in host network mode.
<FromGitter> <diegogub_gitlab> trying out with other languages and same configuration seem to work
<FromGitter> <talbergs> do you know about `docker.for.mac.localhost`?
<FromGitter> <diegogub_gitlab> @talbergs no, sorry. what's that? I'm running on linux
<FromGitter> <talbergs> nvm, that is an answer to most of problems relating DNS if you on OSX.
zorp_ has joined #crystal-lang
<FromGitter> <ninetailschris> Is there a way to edit the elements in a Array(JSON::Any)?
<FromGitter> <asterite> Yes
gtramontina has joined #crystal-lang
shalmezad has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <vladfaust> I'm having 100k rps with wrk on 4 cores
<FromGitter> <vladfaust> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b853ea9d8d36815e59fb3f2]
return0xe has quit [Remote host closed the connection]
return0xe has joined #crystal-lang
return0xe has quit [Remote host closed the connection]
return0xe has joined #crystal-lang
<FromGitter> <vladfaust> Aand, I was doing it wrong
zorp has joined #crystal-lang
return0xe has quit [Remote host closed the connection]
return0e has joined #crystal-lang
zorp_ has quit [Ping timeout: 268 seconds]
<jokke> hm is there no way to easily convert yaml to json in crystal?
Flipez has quit [Quit: The Lounge - https://thelounge.github.io]
Flipez has joined #crystal-lang
Flipez has quit [Client Quit]
<FromGitter> <yxhuvud> yaml is not necessarily transferable to legal json.
<FromGitter> <yxhuvud> json on the other hand doesn't need to be converted - it is already legal yaml.
Flipez has joined #crystal-lang
alex`` has quit [Ping timeout: 244 seconds]
<FromGitter> <j8r> How can I convert a JSON::Any to Yaml?
alex`` has joined #crystal-lang
<jokke> Yxhuvud: sure, but shouldn't at least Hash(String, JSON::Any).from_yaml work?
<jokke> it seems hash doesn't implement from_yaml
<jokke> which is weird to me
<jokke> never mind
<jokke> of course it does
<jokke> wait what..? recursive aliases aren't possible anymore?
<jokke> no i'm just dum
<jokke> b
<FromGitter> <talbergs> Uff, @vladfaust I found that my shard will not work (as I stated above) because of hyphen in it's name, changed `name: crystal-dgraph` into `name: dgraph` and I could `require "dgraph"`, but not `require "crystal-dgraph"` seems like #bug ?
<jokke> hm so there's no way of parsing yaml into a json conform data structure?
<FromGitter> <vladfaust> @talbergs never had such an issue, maybe you've done something wrong like mispelled shard name in either shard.yml
<FromGitter> <omarroth> Hello everyone! I just ported openssl.cr (https://github.com/datanoise/openssl.cr) to 0.26, the PR here (https://github.com/datanoise/openssl.cr/pull/16)
<FromGitter> <omarroth> It looks like it hasn't got much attention since February of 2016
<FromGitter> <omarroth> All the specs pass (except for HMAC, which has already been added to stdlib) but it doesn't work as a shard right now
<FromGitter> <omarroth> I guess my question is, should I try to spin out pieces (RSA is my main interest) into a PR for the stdlib?
<FromGitter> <plainas> I'm intrigued about raze... How does it differ from kemal? They look almost like clones
<FromGitter> <plainas> anyone used it? why?
<FromGitter> <rishavs> why even consider a web framework? You can use pain old crystal without any issues.
<z64> @plainas i wrote this up for my own reference a long while ago. TL;DR is that they have different higher level tools that you might prefer over the other. https://gist.github.com/z64/6e4d061246bbc6688e7417a757b402e3
<z64> raze is more minimalist than kemal, but you may consider that its just not as far into development. its mostly focused around the way it handles middleware
akaiiro has quit [Ping timeout: 272 seconds]
akaiiro has joined #crystal-lang
<FromGitter> <j8r> and also not maintained anymore
<FromGitter> <j8r> that's why I've finally closed my PR and contribute to Kemal, which has also better tests coverage
<z64> yeah its unfortunate as i really liked the direction raze was heading over kemal
<jokke> does anyone know of a way to provide a dsl to set instance vars of an object where not all if any instance vars are nilable?
<jokke> i already discovered that double splat initializers can be used for mass assigning the instance vars
<jokke> but i'm not sure how a dsl would look like without having to write it completely manually
<jokke> oh and this should be completely type safe too and checked at compile time too :D
gtramontina has quit [Remote host closed the connection]
<jokke> this is a neat trick though
<jokke> weird tabs... this is better https://p.jokke.space/j28rsM/crystal
gtramontina has joined #crystal-lang
akaiiro has quit [Ping timeout: 272 seconds]
gtramontina has quit [Ping timeout: 272 seconds]
gtramontina has joined #crystal-lang
gtramontina has quit [Ping timeout: 252 seconds]
DTZUZO has quit [Ping timeout: 252 seconds]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
<jokke> how is HTTP::Headers{} implemented?
gtramontina has joined #crystal-lang
gtramontina has quit [Ping timeout: 268 seconds]
<FromGitter> <ninetailschris> How can I convert Array(JSON::Any) into a regular array?
<FromGitter> <asterite> it depends... what do you have in the `JSON::Any`?
gtramontina has joined #crystal-lang
<FromGitter> <ninetailschris> its just nested arrays with intergers and strings inside an array example being [[127, [12, 24, 22, 13, 14, 18], [0, 252, 0, 0, 0, 0, 0], 100, 2352, 13, 1, 0, false, "Cow", 0]]
<FromGitter> <bew> false in your data is not a string or an integer
<jokke> wu... instance variable '@schemas' of OpenAPI::Components must be (Hash(Symbol, OpenAPI::Reference | OpenAPI::Schema) | Nil), not Hash(Symbol, OpenAPI::Schema)
<jokke> *wut
<FromGitter> <ninetailschris> Forgot to add bool. Sorry about that
<jokke> how is Hash(Symbol, OpenAPI::Schema) not a part of (Hash(Symbol, OpenAPI::Reference | OpenAPI::Schema) | Nil)?
<jokke> z64: take a look at prism
<jokke> early stages but really cool
<jokke> especially the param handling
<z64> yeah i've been meaning to. writing the frontend component for my project soon, so i plan to start re-evaluating what my webserver needs will be
<FromGitter> <girng> @atna ty for explanation same for @woodruffw. i'm going to just stick to methods for now until i need to use procs
<FromGitter> <paulcsmith> Yay for 0.26.1! Thanks for the new release Crystal team :D
<FromGitter> <paulcsmith> Homebrew having a release at the same time is an extra nice surprise 👍
RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.26.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
gtramontina has quit [Ping timeout: 244 seconds]
gtramontina has joined #crystal-lang
moei has quit [Quit: Leaving...]
<FromGitter> <bcardiff> :-) < 24hs between tagging and releasing. I know in this era of extra connectivity it seems like an eternity, but with the whole process is not that much.
gtramontina has quit [Ping timeout: 244 seconds]
gtramontina has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.2]
<FromGitter> <vlazar> feel free to review my second attempt at updating TFB benchmarks to latest Crystal & frameworks https://github.com/TechEmpower/FrameworkBenchmarks/pull/4020
<FromGitter> <vlazar> will look into build failure later
<FromGitter> <rishavs> Hey @vlazar do you know if the nodejs frameworks are run in a single process?
<FromGitter> <vlazar> I think nodejs frameworks should be running as a clusters, but haven't looked into this
akaiiro has joined #crystal-lang
<FromGitter> <eliasjpr> Interesting presentation about Scala compiler
<FromGitter> <girng> @rishavs which ones?
<FromGitter> <girng> @rishavs if they don't u can use pm2 and basically make nodejs run on multiple cores.and use redis for pub sub thjat's what i use to do
<FromGitter> <girng> now that I think of it, we can do the same with crystal since their redis shard is epic
ua__ has quit [Quit: Leaving]
<FromGitter> <rishavs> fastify.io mainly. I am torn between fastify and crystal based REST api. my deployment plan is to use a single processor doker container and then conjure up as many instances of the server as I need to.
<FromGitter> <rishavs> And fastify compares well wit crystal in terms of single processor speed.
ua has joined #crystal-lang
<FromGitter> <vlazar> @rishavs are you comparing some real REST API endpoint in Crystal/fastify or is it just a hello world benchmark?
<FromGitter> <rishavs> I am looking to decide on a lang/framework for my next toy project. It is to be a spa with a rest api based backend. so, no code so far.
<FromGitter> <rishavs> itching to give elm 0.19 a try
<FromGitter> <vlazar> TFB results provide at least some idea of what to expect in different scenarious
<FromGitter> <vlazar> for example Crystal performs very well in JSON benchmark
<FromGitter> <vlazar> for DB the results are not that excited, but it's a good idea to benchmark you specific use case, not some generic
<FromGitter> <rishavs> yep
akaiiro has quit [Remote host closed the connection]
<FromGitter> <j8r> If you use an integrated db like leveldb or rocksdb you can get the best performance, specially there is no ffi overhead
akaiiro has joined #crystal-lang
gtramontina has quit [Ping timeout: 272 seconds]
gtramontina has joined #crystal-lang
gtramontina has quit [Ping timeout: 240 seconds]
gtramontina has joined #crystal-lang
akaiiro has quit [Quit: Ping timeout (120 seconds)]
gtramontina has quit [Ping timeout: 272 seconds]
akaiiro has joined #crystal-lang
Groogy has quit [Quit: WeeChat 2.2]
gtramontina has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
<FromGitter> <GaryMiller> Is SQLite integrated too? Or does it require the ffi overhead? When the Windows Crystal is ready I was hoping to port my pypy SQLite projecct to it to see if I could get a speedup.
gtramontina has quit [Ping timeout: 245 seconds]
akaiiro has quit [Ping timeout: 246 seconds]
akaiiro has joined #crystal-lang
gtramontina has joined #crystal-lang
tilpner has quit [Remote host closed the connection]
<FromGitter> <bcardiff> @GaryMiller crystal-sqlite uses libsqlite3 . crystal-mysql and pg implement the protocol without extra dependencies.
moei has joined #crystal-lang
tilpner has joined #crystal-lang
akaiiro has quit [Ping timeout: 240 seconds]
akaiiro has joined #crystal-lang
gtramontina has quit [Ping timeout: 252 seconds]
gtramontina has joined #crystal-lang
shalmezad has quit [Quit: Leaving]
gtramontina has quit [Ping timeout: 246 seconds]
gtramontina has joined #crystal-lang
gtramontina has quit [Ping timeout: 245 seconds]
gtramontina has joined #crystal-lang
<FromGitter> <j8r> @GaryMiller and there is no ffi overhead in Crystal
gtramontina has quit [Ping timeout: 246 seconds]
sevensidedmarble has joined #crystal-lang
gtramontina has joined #crystal-lang
Yxhuvud has quit [Ping timeout: 276 seconds]
gtramontina has quit [Ping timeout: 245 seconds]
<FromGitter> <diegogub_gitlab> someone using crystal in docker from scratch? I'm having issues with ssl.. @bcardiff I followed your post on the blog
sevensidedmarble has quit [Ping timeout: 264 seconds]
sevensidedmarble has joined #crystal-lang
<sevensidedmarble> Is there a way to get the arguments defined on a proc?
<FromGitter> <bcardiff> @diegogub_gitlab you might need to install openssl or libssl manually
gtramontina has joined #crystal-lang
<FromGitter> <diegogub_gitlab> do you mean copying the correct files to the scratch right?
<FromGitter> <bcardiff> that or running apt-get install in the Dockerfile. it depends in your dev env
<FromGitter> <diegogub_gitlab> @bcardiff I see.. I will try, the issue I think is that openssl can't find the certs on the docker scratch, because I tried to turn off validation and works for https..gracias!
<FromGitter> <bcardiff> Try to make a small sample of what you are trying to do so you can share some code. De nada!
gtramontina has quit [Ping timeout: 252 seconds]
sevensidedmarble has quit [Ping timeout: 252 seconds]
gtramontina has joined #crystal-lang
sagax has quit [Ping timeout: 252 seconds]
gtramontina has quit [Ping timeout: 240 seconds]
sevensidedmarble has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
gtramontina has joined #crystal-lang
gtramontina has quit [Client Quit]