<FromGitter>
<Blacksmoke16> prob some internal thing that allows it
<FromGitter>
<dscottboggs_gitlab> that's hacky
return0e has quit [Ping timeout: 240 seconds]
<FromGitter>
<dscottboggs_gitlab> I saw a post (https://this-week-in-rust.org/blog/2019/01/22/this-week-in-rust-270/) on a blog about Rust earlier that said rust was a language which is "persuing the trifecta: safety, concurrency, and speed". In my opinion, concurrency should go under speed and readability should take it's place as a member of "*the* trifecta", and I think in that case crystal fits the bill a lot better
<FromGitter>
<dscottboggs_gitlab> s/readability/expressiveness/ but you get my point
<FromGitter>
<girng> @j8r lol websockets are far superior than server-sent events :)
jemc has joined #crystal-lang
jemc has quit [Client Quit]
jemc has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter>
<proyb6> @j8r H2O web server is working to get Websocket on HTTP/2 wip, new to me
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
jemc has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
DTZUZO_ has quit [Ping timeout: 245 seconds]
<FromGitter>
<sam0x17> how to urldecode in crystal?
<FromGitter>
<proyb6> @sam0x17 where do you get the urls from?
<FromGitter>
<proyb6> Is it feasible to create fast and slow routes in your urls?
<FromGitter>
<j8r> @girng @proyb6 I wonder if I still *need* a websocket server to push events on the client, or do it with bare HTTP/2?
<FromGitter>
<proyb6> I’m curious where you get the HTTP2 from?
<FromGitter>
<sam0x17> @proyb6 I have clients that connect to my distributed lock server, the clients are also crystal programs on customer machines (for now just osx and linux) that use FUSE to mount a virtual cloud-based encrypted + compressed file system, and the distributed lock mechanism is how I am preventing users from overwriting each others' data. The whole thing has taken me years of research and involves some data
<FromGitter>
... structures and indexing techniques that I will eventually be publishing. Originally I wrote this in node.js but callback hell and poor maintainership by the guy who runs the node-fuse repo led me to start over from scratch with client and server written in crystal
<FromGitter>
<sam0x17> so in short, the urls come from a crystal program that I also control (it's my API)
<FromGitter>
<sam0x17> ;)
<FromGitter>
<sam0x17> the code I showed before is just toy code while I figure out the limitations of HTTP::Server
<FromGitter>
<vladfaust> @j8r thanks for the link
<FromGitter>
<vladfaust> SSE could be multiplexed with HTTP/2. So we could get use of that right now with Nginx, even if we don't have native HTTP/2 implementation, right?
<FromGitter>
<proyb6> Nice @sam0x17 i agreed HTTP::Server may need to manage memory well too
<FromGitter>
<proyb6> Nginx using proxying?
<FromGitter>
<proyb6> @vladfaust
<FromGitter>
<vladfaust> Yep
<FromGitter>
<proyb6> I’m concern is the performance which may be slow
<FromGitter>
<proyb6> I can imagine if Crystal could be written as a proxy server but it’s hard
<FromGitter>
<mavu> the dangerous thing about it is that it always results in a legal expression
<FromGitter>
<mavu> you can only notice the error when you find the bug that it inevitably produces.
<FromGitter>
<mavu> @r00ster91 lucky you :P
<FromGitter>
<yxhuvud> @mavu I wouldn't want a warning for that, as it is a very common patter to do `if some_value = @some_value`, to strip nilable instance variable of the nilability.
jemc has joined #crystal-lang
<FromGitter>
<mavu> @yxhuvud maybe just a warning you can enable once with a compiler flag before you can make a release? ⏎ but I guess I could just write a regexp that shows me the lines
<FromGitter>
<proyb6> Benchmark Kemal and memory peak at 1GB+ on 30,000K connections, Actix (Rust) memory ownership mean use far less than Crystal and free memory so fast. Any thought on HTTP server on Crystal could use less memory?
jemc has quit [Ping timeout: 244 seconds]
jemc has joined #crystal-lang
<FromGitter>
<j8r> have you set `reuse_port: true`?
<FromGitter>
<j8r> @asterite I thought of `a := true` could expand to `a : Bool = true`, even in method arguments like `my_method(a := true)` == `my_method(a : Bool = true)`
<FromGitter>
<yxhuvud> @dscottboggs_gitlab It works in emacs. :shrug:
<FromGitter>
<dscottboggs_gitlab> good to know. Atom and the playground think the part on the same line after the HERE is part of it
<Yxhuvud>
Does Atom handle it for ruby files?
<FromGitter>
<dscottboggs_gitlab> good question!
<FromGitter>
<dscottboggs_gitlab> it does, but I think the ruby syntax is using Atom's new syntax highlighting engine and the crystal one is not
<FromGitter>
<r00ster91> I'
<FromGitter>
<r00ster91> So I'm currently having the problem that I have an array which has the wrong type and then in the error it shows me the type, the array actually needs. So I give it the type but then when I run it again, it tells me that the array needs a different type and the type it needs is twice as long as before. And that goes so on infinitely. How can I specify in a type annotation that this will be recursive and might
<FromGitter>
... never end?
<FromGitter>
<r00ster91> Here: https://carc.in/#/r/63x6 ⏎ Give the type after "with type" in the error over and over to the `array` in the code and it will never end. I know in this code it actually never ends and would result in a stack overflow or something but in my code it does not.
<FromGitter>
<Blacksmoke16> use a diff name?
<FromGitter>
<Blacksmoke16> one that doesnt conflict with method name
<FromGitter>
<HarrisonB> If you use ALE for vim, Ameba (crystal linter a la rubocop) support has just been added :)
<FromGitter>
<matthewmcgarvey> nice 👍
<FromGitter>
<fridgerator> has anyone tried writing user-space device driver code with crystal?
<lvmbdv>
userspace driver? what platform?
<FromGitter>
<fridgerator> arch linux on an arm processor
<FromGitter>
<matthewmcgarvey> crystal has external dependencies that might make that hard. Unless I'm misunderstanding
<FromGitter>
<fridgerator> I think you're probably right. I was just curious if anyone had messed around with it though
<FromGitter>
<girng> hi
<FromGitter>
<AmberSaber> Will this language replace ruby?
<FromGitter>
<r00ster91> well it's not like if this language is successfull, Ruby won't be maintained anymore and everyone uses Crystal. But the most people come from Ruby because it's faster and type safe. So it's your own decision if this language replaces Ruby for you
<FromGitter>
<AmberSaber> I was very excited when I knew that the language had the same grammar as ruby. I changed the ID on my social networking site to amber+saber.
<FromGitter>
<AmberSaber> In fact, ruby is not popular in China at all. The three most popular languages in China are java, JavaScript, and Python. But I think the crystal will be more than ruby.
<FromGitter>
<r00ster91> don't you mean Japan?
<FromGitter>
<drum445> Hello, how do I call a mysql stored proc using the database shard?
<FromGitter>
<drum445> I keep getting this: Exception: Incorrect arguments to mysqld_stmt_execute (Exception)
<FromGitter>
<r00ster91> what are the arguments you gave?
<FromGitter>
<AmberSaber> I think the Japanese should love ruby very much. After all, the inventor is a Japanese.
<FromGitter>
<theretromaniac> Here in Greece I think I am the only one using Crystal
<FromGitter>
<theretromaniac> 😆
<FromGitter>
<drum445> @r00ster91 I was being an idiot, always seem to see your mistake after you've asked the question. Apologies
<FromGitter>
<AmberSaber> The Chinese invented a language that uses Chinese character programming, but now many languages support Unicode, and it is no longer necessary. So it was eliminated. That is to say, the Chinese did not invent any language.
<FromGitter>
<theretromaniac> It is very difficult a non English language to succeed.
<FromGitter>
<AmberSaber> In fact, I am a fan of a static language. I have a few English letters on my body.
<FromGitter>
<AmberSaber> RAII
<FromGitter>
<theretromaniac> I never heard of.
<Yxhuvud>
You like C++ that much?
<FromGitter>
<AmberSaber> But self-study static language is more difficult, ruby and Python will be simpler. It is very suitable for promotion. Using Chinese programming is a national pride
<FromGitter>
<AmberSaber> Yes, it is complicated,but I am very happy
<FromGitter>
<AmberSaber> C++ can let me understand a lot of details, actually I think I still need a long time to master it.
<FromGitter>
<j8r> A cyrilic based programming language will be OK for me
<FromGitter>
<theretromaniac> I don't think national pride fits in the world of programming
<FromGitter>
<j8r> I think alphabets fits more programming language than having 10000 possible ideograms
<FromGitter>
<AmberSaber> But crystal can be used as my alternative, I think it will be very happy too.
<FromGitter>
<theretromaniac> @j8r indeed. I want a programming language in ancient greek.
<FromGitter>
<Blacksmoke16> Webdings ^
<FromGitter>
<j8r> C++ is bloated as hell
<FromGitter>
<theretromaniac> It will be in the same category with brain fuck
<FromGitter>
<AmberSaber> But crystal can be used as my alternative, I think it will be very happy.
<FromGitter>
<AmberSaber> But crystal can be used as my alternative, I think it will be very happy.
<FromGitter>
<j8r> Rust is like a rethought C++. Nowadays, you'll better go with it unless legacy code
<FromGitter>
<AmberSaber> Of course, everything has a historical background, and China was not open enough at the time. Very few programmers, and their English is very poor
<FromGitter>
<j8r> Crystal is a good compromise, indeed
<FromGitter>
<j8r> Chinese are coming in Open source really hard this days!
<FromGitter>
<drum445> Can't read stored proc results from crystal mysql driver?
<FromGitter>
<drum445> I remember seeing this in old versions of ruby
<FromGitter>
<j8r> What I hate with latin alphabet is: I, l, 1 and O 0
<FromGitter>
<AmberSaber> History always moves forward, and perhaps the Chinese can create more useful things in the future. Instead of using your results directly, you are forced to modify the open source license !
<FromGitter>
<theretromaniac> @j8r the first two is a debugging nightmare.
<FromGitter>
<AmberSaber> I also like D very much, but it is also very complicated.
<FromGitter>
<drum445> Anyone else seen issues with result sets from stored procs?
<FromGitter>
<AmberSaber> I know that there is a guy in China who likes ruby very much, who wants to say ruby is not good. He will be very angry. But after rust was invented, he fell in love with rust, and he became more unreasonable.
<FromGitter>
<AmberSaber> Complex things are actually not good. There is a saying in China that:The greatest truths are the simplest
<FromGitter>
<sam0x17> @proyb6 here is how I made an abstraction of `HTTP::Server` that serves requests concurrently using fibers and channels (e.g. request B can arrive and be served while request A is still being worked on) allowing for endpoints that block for a period of time, etc: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c4f5f0c8aa5ca5abf482705]
<FromGitter>
<AmberSaber> But I like to make him angry, although I don't know ruby and rust. I know this is wrongGoodbye, wait until I have trouble and chat with you.
<FromGitter>
<girng> @AmberSaber what do you mean by `Using Chinese programming is a national pride`?
<FromGitter>
<j8r> Does the chinese programing language is top to bottom, left to right?
<mps>
j8r: tried forth
<FromGitter>
<AmberSaber> Because China wants to invent a system that is completely different from the US: the operating system and the language. Every year, the government encourages the development of policies that are part of China's operating systems. In addition, the people who invented the programming language at that time did not actually receive university education. At that time, people were instilled with many nationalist
<FromGitter>
... ideas. And that person also expressed this meaning on his social networking site.
<FromGitter>
<AmberSaber> In fact, every Chinese, except the children of the rich. They have been instilled in this idea. It is necessary to let the Chinese stand at the top of all fields of the world. This is repeatedly emphasized.
<FromGitter>
<theretromaniac> @j8r i suppose this stands for arab programming language
fanta7531 has quit [Quit: fanta7531]
<FromGitter>
<AmberSaber> @j8r
<FromGitter>
<AmberSaber> 是的,从左到右,从上到下
<FromGitter>
<AmberSaber> China also has Muslims and Turkic peoples.
<FromGitter>
<girng> wtf are you talking about
<FromGitter>
<AmberSaber> The languages of these minorities are from right to left.
<mps>
j8r: forth is RPN stack oriented
<mps>
i.e.: '2 2 +' expression
<mps>
so, some kind of 'right to left'
<FromGitter>
<AmberSaber> I am saying that the Chinese did not invent any useful programming language, currently. But the Japanese invented ruby
<FromGitter>
<girng> @AmberSaber you mean mainstream programming language? i'm sure they are useful programming languages developed by chinese people
<FromGitter>
<theretromaniac> ruby became famous because it is in english. If ruby was in japanese i suppose that we will never hear about.
<FromGitter>
<AmberSaber> Sorry, I have to use VPN
<FromGitter>
<j8r> @mps a bit like a reverse lisp?
<mps>
j8r: don't know much list to make parallels in them, but forth is only high-level language implemented in CPU hardware
<FromGitter>
<AmberSaber> Are you saying which one is useful?
<mps>
long time ago I ported it to Z80 CPU to work from ROM
<FromGitter>
<j8r> :O
<mps>
it is interesting to learn to attain new paradigm in programming, i.e. look at programming from different angle
<FromGitter>
<AmberSaber> What problems are solved by these languages? Is it better to use them than to use visualization tools?
<mps>
it was (and maybe still is) used in real time devices, i.e. aircfraft fighters
<FromGitter>
<AmberSaber> I don't think the Chinese are currently able to invent useful languages because there are no experienced programmers like Europe and the United States. They have a hard time summarizing the deficiencies of the tools and making better solutions.
<FromGitter>
<j8r> I read Forth is used in Philae
<FromGitter>
<j8r> @AmberSaber could you avoid generalities please? We aren't here to think if X people vs Y people on Z things
<FromGitter>
<AmberSaber> Of course they can be like those people: get the functional language to jvm, or get JavaScript to jvm. I think Chinese people can get assembly language on jvm.Because all the combinations have been used up
<FromGitter>
<AmberSaber> okay
<FromGitter>
<j8r> Everyone is capable or everything, Chinse invented Vue.js for instance. If Argantina can bring us a nice language like Crystal, China is definitely able too :)
<FromGitter>
<j8r> @mps good job! was it hard to implement forth?
<mps>
j8r: not really, I did it to learn how it works and to understand it deeply
<FromGitter>
<AmberSaber> Everyone is capable or everything, Chinse invented Vue.js for instance. If Argantina can bring us a nice language like Crystal, China is definitely able too
<mps>
about 40 words (functions) in assembler and rest as forth functions, where they called words
<FromGitter>
<AmberSaber> I mean, we have to study hard.
<mps>
and some assembly code to 'boot' it
<FromGitter>
<j8r> Interesting! Z80 was motorola?
<FromGitter>
<j8r> I read "Zilog"
<mps>
no, Zilog Inc. Sinclar spectrum and some japanese msx and some german computers at that time
<FromGitter>
<j8r> I may confuse with another product
<jemc>
@AmberSaber - innovations are largely a product of individual action, and national/cultural/racial stereotypes (apart from often being offensive) are far from effective at being good predictors of individual characteristics - that's why it's really frustrating to listen to generalities about what X and Y people are capable of
<mps>
at that time motorola had 6800 and later 68000 series CPU's
<mps>
j8r: you wrote 'cyrillic'? is that your native script?
<FromGitter>
<AmberSaber> But I emphasize that the history of Chinese people's exposure to computer science is very short, and we cannot have enough experience to make great innovations. All we can do is based on your work, but the leaders of our country don't care about it. For example, they asked to invent their own operating system, and supporting tools.
<FromGitter>
<j8r> No mps, but I know some letters of it.
<mps>
aha, thanks for explanation and sorry for curiosity
<FromGitter>
<j8r> @AmberSaber there is no you or us, just we. We all base our work on previous ones
<FromGitter>
<AmberSaber> For example, our country wants to develop CPU, but it is used by a university professor. He went to take Motorola's chip to pretend to be his invention, of course he removed the information about Motorola.
<FromGitter>
<AmberSaber> I know I know
<FromGitter>
<j8r> Yes, but you bring improvements. Then, European are even copying chinese companies like Xiaomi
<FromGitter>
<AmberSaber> Because someone asked me why using Chinese programming is national pride
<FromGitter>
<j8r> We also "copy" Open Source projects, this is called forking
sagax has joined #crystal-lang
ternarysolo has joined #crystal-lang
<FromGitter>
<AmberSaber> Yes, this is the best way to improve based on others' work and make it better
<FromGitter>
<j8r> mps have you tried RISC-V?
<FromGitter>
<AmberSaber> But with Chinese programming, he loses the opportunity to communicate with the outside world.
<mps>
not yet, it is hard to obtain, it costs about 999$ and need some preorders
<mps>
I had a chat with man who porting Alpine Linux to it
<mps>
when it become available on the market where I live I will buy it for sure
<mps>
but, now, I work mostly on ARM's
<FromGitter>
<AmberSaber> Someone mentioned above said that it is very difficult to succeed in non-English programming. This is because English is similar to XML or json in a language. Communication allows us to exchange ideas and make me do better
<FromGitter>
<AmberSaber> I think I should stop this topic, because it is unrealistic.
<mps>
I would like if the international communications are established in some ancient languages like Latin or Sanskrit, but the reality is something what doesn't care of our likes or dislikes
<FromGitter>
<Blacksmoke16> back on topic now...
<FromGitter>
<Blacksmoke16> heres a question
<FromGitter>
<j8r> mps there are boards costing ≈ $50 now
<FromGitter>
<AmberSaber> The Loonxin chip developed in China is based on the MPS architecture.
<FromGitter>
<j8r> @AmberSaber you mean MIPS architecture. AFAIK mps hasn't done one yet haha
<FromGitter>
<AmberSaber> If the problem is not resolved in time, it will often hurt the confidence and patience of the learner.
<FromGitter>
<Blacksmoke16> ok
<FromGitter>
<j8r> @Blacksmoke16 use a pointer (I'm kinding)
<FromGitter>
<AmberSaber> I don't know the chip architecture, it is also the ambition of the Chinese government.
<mps>
j8r: Blacksmoke16 is right, we should discuss OT themes somewhere else.
<FromGitter>
<j8r> Yes
<FromGitter>
<AmberSaber> There are many things in China that you may not understand. We all use x86 architecture or arm architecture products. Almost no one, there are no other products on the market.
<FromGitter>
<j8r> What are you trying to do @Blacksmoke16 ?
<FromGitter>
<Blacksmoke16> not what i was trying to say when i said that was kinda rude, but ok
<FromGitter>
<j8r> You were answering @AmberSaber i suppose
<FromGitter>
<Blacksmoke16> pretty much
<FromGitter>
<Blacksmoke16> anyway
<mps>
Blacksmoke16: it's ok to remember what is a topic of this channel, no problem with me
<FromGitter>
<j8r> I guess it's fair to talk a bit of other IT related fields if no one is talking Crystal. But, yes, Crystal is priority – back to the channel's root
<FromGitter>
<Blacksmoke16> main points are line 154, 185, and 215
<FromGitter>
<Blacksmoke16> it works for the select but breaks down for the joins
<FromGitter>
<Blacksmoke16> since each instance of `LogicOperator` would have its own `@joins` array
<FromGitter>
<Blacksmoke16> whereas they need to be shared by an overarching class
<FromGitter>
<Blacksmoke16> i was using the class var approach for the params but it feels hacky
<FromGitter>
<Blacksmoke16> other idea i had would be to have a named param like `modifiers: Array(QueryModifer)` on #match
<FromGitter>
<Blacksmoke16> so i wouldnt have to worry about them being deeply nested in the recursive `LogicOperator`
<FromGitter>
<j8r> Essentially you have a collection of classes and want to share them a same variable?
<FromGitter>
<Blacksmoke16> pretty much yea
<FromGitter>
<j8r> They can share a same class. Class is passed by reference
<FromGitter>
<j8r> I mean an instance var, that is a class
<FromGitter>
<Blacksmoke16> via inheritance?
<FromGitter>
<j8r> No necessarily.
<FromGitter>
<yorci> Hi, how can i check nil correctly?, "unless x.nil?" is not enough for nil check? ⏎ ⏎ thats my code and it returns no overload matches nil type, i have also tried is_a?(Nil) same error. ⏎ ⏎ ```... no overload matches 'Float32#+' with type (Float32 | Nil) ⏎ - Float32#+(Nil)``` [https://gitter.im/crystal-lang/crystal?at=5c4f789f41775971a09c2a74]
<FromGitter>
<j8r> Try to change || by && @yorci
<FromGitter>
<j8r> Sec @Blacksmoke16
<FromGitter>
<yorci> @j8r same but this time error for room.type
<FromGitter>
<matthewmcgarvey> If `bonus_balance` and `win1` can not be tightened to not be nillable then you'll have to do the same thing for them as well
<FromGitter>
<Blacksmoke16> if i could pass an ivar to `get_filter` that would bet set there that would be perfect i think. if that is what you were meaning
<FromGitter>
<matthewmcgarvey> @yorci the problem isn't user or room, its the methods you're calling are returning `(Float32 | Nil)`
<FromGitter>
<yorci> i see
<FromGitter>
<yorci> but classes returns only float32
<FromGitter>
<sam0x17> and for the curious, going back from an int type to a slice can be done via: ⏎ ⏎ ```io = IO::Memory.new ⏎ 78_u64.to_io(io, IO::ByteFormat::LittleEndian) ⏎ puts io.to_slice``` [https://gitter.im/crystal-lang/crystal?at=5c4f87c654f21a71a1bffeff]
DTZUZO_ has joined #crystal-lang
<jokke>
any eta to 0.28 ?
<FromGitter>
<Blacksmoke16> 1) 27.1 would be next iirc?
<FromGitter>
<dscottboggs_gitlab> mps that's great to hear, thanks
<mps>
you are welcome, it was a pleasure to upgrade it because i'm learning crystal and plan to use it in my projects
<jokke>
awsome
<jokke>
*awe
<mps>
now I don't have much time to build with llvm6 because trying to port rust to alpine aarch64 and armv7 but I hope that will have time to build it with llvm6
<mps>
actually i built it with llvm6 but test/spec fails
<FromGitter>
<dscottboggs_gitlab> someone else was having trouble with LLVM 6.0.0 as well
<FromGitter>
<dscottboggs_gitlab> They said 6.0.1 would probably work but they couldn't figure out how to install it
<mps>
to me looks like crystal and llvm6 doesn't works well on musl libs, of course
<FromGitter>
<dscottboggs_gitlab> oh I'm sorry to hear that
<mps>
I built rust with llvm6 and it works, but crystal fail on test