ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.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
Gasher^^ has joined #crystal-lang
Gasher^ has quit [Ping timeout: 240 seconds]
snsei has joined #crystal-lang
greengriminal has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <ziprandom> just updated README with clearer usage example
snsei 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
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
bmcginty has quit [Ping timeout: 260 seconds]
bmcginty has joined #crystal-lang
rohitpaulk has joined #crystal-lang
greengriminal has quit [Quit: Leaving]
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <codenoid> really fun work with cr <=> py <=> node, 😆 💯
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
sp4rrow has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
tliff has quit [Ping timeout: 248 seconds]
baweaver has quit [Ping timeout: 248 seconds]
Gasher^ has joined #crystal-lang
tliff has joined #crystal-lang
Gasher^^ has quit [Ping timeout: 248 seconds]
p0p0pr37 has quit [Ping timeout: 248 seconds]
p0p0pr37_ is now known as p0p0pr37
g3funk has quit [Ping timeout: 260 seconds]
g3funk has joined #crystal-lang
baweaver has joined #crystal-lang
baweaver has quit [Changing host]
baweaver has joined #crystal-lang
rohitpaulk has joined #crystal-lang
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
DTZUZO has quit [Ping timeout: 246 seconds]
snsei has joined #crystal-lang
Papierkorb_ has joined #crystal-lang
rumenzu has joined #crystal-lang
Tuxified has joined #crystal-lang
Tuxified has quit [Client Quit]
<FromGitter> <elorest> https://twitter.com/
snsei has quit [Remote host closed the connection]
<crystal-gh> [crystal] akzhan closed pull request #4931: [WIP] try to reproduce bug in 32bit (master...example-of-bad-code-for-x86-bigint) https://git.io/v5afi
mark_66 has joined #crystal-lang
<crystal-gh> [crystal] akzhan reopened pull request #4931: [WIP] try to reproduce bug in 32bit (master...example-of-bad-code-for-x86-bigint) https://git.io/v5afi
claudiuinberlin has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 255 seconds]
DTZUZO has joined #crystal-lang
<FromGitter> <bararchy> Proud moment :) https://github.com/crystal-lang/crystal/wiki/Used-in-production#cyber-security ⏎ ⏎ Thanks Crystal Team, and thanks to all great comunity members for all the time and effort put into this great lang
<FromGitter> <elorest> https://twitter.com/
<FromGitter> <bararchy> @elorest Cool !
<FromGitter> <sdogruyol> Morning everyone
<FromGitter> <sdogruyol> good job @elorest 👍
<FromGitter> <bararchy> @sdogruyol Morning :)
Tuxified has joined #crystal-lang
<FromGitter> <sdogruyol> Great to see your company on the list @bararchy 👏
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
<Papierkorb_> Why is MySQL so popular over postgres with Crystal?
<Papierkorb_> is the postgres driver just bad?
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tuxified has joined #crystal-lang
<FromGitter> <crisward> Not sure, for me it's because I came from a Lamp background, so mysql is more familiar.
<FromGitter> <crisward> In terms of github stars, the postgres driver seems miles ahead
<Papierkorb_> Postgres is simply miles ahead
<Papierkorb_> Also, no Oracle, so that's a plus by itself
<FromGitter> <crisward> I've been tripped up by postgres a few times. Also used to be slower in php, probably a driver issue. With databases its often easier to stick with what you know. I actually use Mariadb, which as you may know is a fork of mysql.
<FromGitter> <bew> @bararchy
<FromGitter> <bew> The link in the wiki is 404
<FromGitter> <bararchy> @bew Are you sure, it seems to work for me
<FromGitter> <bararchy> I get to the site
<FromGitter> <bararchy> does http://neuralegion.com/ Opens for you ?
<Papierkorb_> works here
<FromGitter> <bararchy> Thanks for confiramtion Papierkorb_ :) ⏎ @bew maybe local issue ?
<FromGitter> <bew> it was on my phone, I'm re-checking
<livcd> oh just saw that the rubymotion guy retweeted sdogruyol for crystal survey :-)
<FromGitter> <sdogruyol> yeah 👍
<livcd> too bad microsoft took him :-)
<FromGitter> <bew> @bararchy it works on the computer, but on the phone it redirects to a random page everytime (neuralegion.com/VOpWZ or neuralegion/RinpZ ...), during 4-5 loads I got the page (without 404) only once..
<FromGitter> <bararchy> Woot
<FromGitter> <bararchy> wierd
<FromGitter> <bararchy> let me check
<FromGitter> <bew> weird again, it seems to be working now, I didn't change anything
<FromGitter> <bararchy> Seems to work for me on both FireFox for android and the regular android browser
<FromGitter> <bararchy> thanks for checking though :)
<FromGitter> <bew> I'm using chrome on android
<FromGitter> <bew> btw, great job ;)
<FromGitter> <bew> ( @bararchy: and the button "view on github" is broken for me too ^^ (blank page) =
<Papierkorb_> bararchy, what are some algorithms or "technology" your tool, or similar tools, commonly use?
A124 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> Similar tools are using static mutations usually, we use genetic algorithms and Neural networks :)
<FromGitter> <bararchy> Thanks @bew
<Papierkorb_> Well I guess exploiting could be considered an optimization problem lol
<FromGitter> <bararchy> Yeha the "view on github" shouldn't even be there, I can't find a way to remove it from the jekyll theme
<FromGitter> <bararchy> haha
<FromGitter> <bararchy> Papierkorb_, well , it all depends on the goal, if the thing you want to achive is crashing the application, then it is hahah
snsei has joined #crystal-lang
<Papierkorb_> bararchy, I never looked much into stuff like that. Sounds interesting though. Maybe if I have time besides revamping bindgen :3
<crystal-gh> [crystal] akzhan closed pull request #4931: [WIP] try to reproduce bug in 32bit (master...example-of-bad-code-for-x86-bigint) https://git.io/v5afi
<Papierkorb_> bararchy, though thanks for the pointers. Interesting that AI (now?) finally reached offensive security
<FromGitter> <bararchy> Papierkorb_ I'm thinking about using bindgen in our product, I want to generate bindings to TensorFlow so we can use there Neural Network + cuda tech, or maybe Torch, both in C++
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <marin117> Does anybody know how to bind C define in Crystal
<FromGitter> <marin117> more like C macro
<FromGitter> <marin117> example: #define func(a,b) (.........)
<Papierkorb_> marin117, write a real C function which simply invokes that macro, then bind that C function
<Papierkorb_> Macros don't really "exist" to the C compiler, they don't have any output by themselves. They don't even have to expand to a valid expression by itself, making matters worse and automatically binding macros a nightmare
<FromGitter> <marin117> I have to bind "official" library so I can't write my own functions
claudiuinberlin has joined #crystal-lang
<Papierkorb_> Sure you can, just write a single .c file doing those wrappers
<Papierkorb_> It's not possible otherwise
<Papierkorb_> Well, or you reimplement the C macro in Crystal
alex-edf has joined #crystal-lang
<FromGitter> <marin117> Thank you :) I guess I'll figure out something
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
bmcginty has quit [Ping timeout: 240 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmcginty has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
claudiuinberlin has joined #crystal-lang
ShalokShalom_ has joined #crystal-lang
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ShalokShalom has quit [Ping timeout: 240 seconds]
<alex-edf> Hi guys, what is the Crystal equivalent to do this?
<alex-edf> I don't find the unpack() methods in the API
<Papierkorb_> alex-edf: See `IO#read_bytes`
<alex-edf> Thanks
<alex-edf> and how to unpack the message length as 4 byte integer
<alex-edf> Papierkorb_: I'm not familiar with byte manipulation
<alex-edf> Could you help me a bit more
<alex-edf> it's adapted to the Chrome Native Messaging example (Python)
<Papierkorb_> Have you checked the Crystal docs of the method I mentioned?
<alex-edf> Yep
<Papierkorb_> What's your issue now?
<alex-edf> I don't understand it xD
<Papierkorb_> What did you try?
<alex-edf> Nothing, I'm at work now
<alex-edf> I'm just reading the doc
<Papierkorb_> So you can't run Crystal code right now?
<alex-edf> Nope :/
<alex-edf> I just want to port my Ruby code to Crystal
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb_> Well, what did you not understand of the docs?
<alex-edf> The byte thing
<Papierkorb_> the what thing?
<alex-edf> I'm not familiar with byte manipulation, so I don't understand the data I get
<alex-edf> which type it's
<alex-edf> what it looks like
<Papierkorb_> You can't implement a protocol you don't understand
<Papierkorb_> Look at #read_bytes again. it even has an example.
<FromGitter> <ziprandom> morning to all
<Papierkorb_> And then ask specific questions on that please
claudiuinberlin has joined #crystal-lang
<FromGitter> <ziprandom> what is the current state of cross compiling and static binaries (+musl). Is there already a stable way to create fully contained binaries to run as a rkt container (possibly on raspberry py)?
<Papierkorb_> RX14 worked on static compiling recently, including a statically linked compiler. he may know more
<RX14> well the best you can do is install the static versions of the libraries and add --status to crystal build
<RX14> you do need musl though
<RX14> and to build libevent and libgc
<RX14> since the apk packages dont provide static versions of those
<FromGitter> <ziprandom> do I have to be on arch? (I'm on debian)
rohitpaulk has quit [Ping timeout: 246 seconds]
<RX14> no you need to be on alpine
<RX14> so do it in docker
<RX14> with a 2-stage build
<RX14> honestly its not worth the effort
<RX14> if you're building a docker container anyway
<RX14> you might as well take the easy route
<FromGitter> <ziprandom> hmm, but can't it be automated? I mean truely portable binaries would be really something
<FromGitter> <ziprandom> what's the easy route?
<RX14> the easy route is dont build static libraries in docker
<alex-edf> Papierkorb_: how to read the first 4 bytes?
<RX14> because it's much less useful inside docker
<RX14> outside docker they're really useful
<RX14> but inside docker theres little point apart from binary size
<RX14> and you can do that with alpine anyway
<Papierkorb_> alex-edf: Did you actually look at , and try to understand, the sample snippet in the docs?
<FromGitter> <ziprandom> hmm, I don't understand but also I'm new to this.
<RX14> if you dont understand then you probably dont want static binaries
<FromGitter> <ziprandom> basically I wonder whether I can compile a crystal programm down to a binary that works by itself
<alex-edf> Papierkorb_: yes
<FromGitter> <ziprandom> and crossplatform
<Papierkorb_> alex-edf: What is not clear about it? Try to be precise please.
<RX14> @ziprandom yes you can but it's hard and very very unlikely to be worth the effort
<RX14> and no not cross architecture
<alex-edf> io.read_bytes(Int32, IO::ByteFormat::LittleEndian)
<RX14> you cant make it work on x86 and arm lol
<FromGitter> <ziprandom> of course
<alex-edf> IO::ByteFormat::LittleEndian represents the first 4 bytes, and returns to Int 32?
<RX14> or even linux and windows
<FromGitter> <ziprandom> but I could compile it for arm or darwin even if I'm on linux
<RX14> nope
<FromGitter> <ziprandom> x86
<FromGitter> <ziprandom> so sad
<RX14> different executable formats
<RX14> mac uses macho
<RX14> linux uses ELF
<RX14> windows uses PE
<RX14> incompatable
<Papierkorb_> alex-edf: Read up on "Endianess", wikipedia should have an article. You should be fine by reading just the summary on the top
<FromGitter> <ziprandom> but rust can do it, no? and go does it pretty well
<RX14> no it cant
<RX14> it can compile for windows from linux probably
<RX14> but not for all 3
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RX14> and youd need a windows compatable linker for linux
<RX14> which is kinda a pain
claudiuinberlin has joined #crystal-lang
<FromGitter> <ziprandom> oh, sorry didn't want to spam the whole thread here
<RX14> blame gitter
<RX14> its fine from irc
<Papierkorb_> Yeah no problem, we're fine ziprandom. In fact, thank you for using gist and not copy/pasting into gitter directly :)
<RX14> @ziprandom GO is special because it reinvents the world just so it can do that
<RX14> it doesnt use any of the traditional infastructure and simply does syscalls directly
<RX14> recreates it own libc in go
<Papierkorb_> Wait, does Go have its own linker?!
<FromGitter> <ziprandom> I just think if crystal could do that it would make scripting languages go extinct
<RX14> go is everything
<RX14> go does everything
<Papierkorb_> Holy sh..
<RX14> yup
<RX14> in fact it doesnt need a linker Papierkorb_
<RX14> because it's all go
<RX14> it needs a trditional linker to link to C
<Papierkorb_> Ah, so the internal linker only supports Go
<RX14> but it just emits the binary without linking because it knows where everything is
<RX14> Papierkorb_, yup
<RX14> @ziprandom sure, get us google fuinds and we'll do that
<RX14> unmtil then we have to be a little more conservative with the NIH
<FromGitter> <ziprandom> yeah no pressure, you are my gods anyway
<vegai> well, the Go creators were plan9 people
<vegai> I figure they found the existing compilers/linkers distasteful
<Papierkorb_> alex-edf: Did you look endianess up? Do you still have questions on what that is?
<vegai> and not just their implementation, but fundamental design as well
<RX14> which would be great if they didnt have terrible taste in how to recreate things
<vegai> creating new ones was probably not a big deal to them
<Papierkorb_> vegai: Oh then it might actually be interesting to look at their architecture, and how it differs from the "classic" design
<RX14> Papierkorb_, the go compiler is completely from scratch
<RX14> it only just got SSA
<FromGitter> <ziprandom> I just have a little use case where I made a small website for people using hugo (static site generator) which is really how most of the websites should be done, but I have to write a script for easy building and deployment, because they don't know how to use the console. So writing a little local webserver that they could use to get a CMS feeling for it would be really fun in crystal, but not If I have to
<FromGitter> ... make them compile it ..
Gasher^ is now known as Gasher
<Papierkorb_> RX14: "from scratch" in which sense?
<RX14> as in no LLVM no nothing
<Papierkorb_> Looks like they were told "here is unlimited time and money, go wild"
<RX14> they wrote the go compiler from go to register allocation to emitting ELF from scratch
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<vegai> Papierkorb_: no, really, they had written several compilers before. It was probably not a big deal at all to them
<Papierkorb_> Which explains why go is so fast at compiling i guess
<RX14> vegai, writing a compiler is always a big deal
<Papierkorb_> does it do any big optimizations?
<vegai> don't you ever get the feeling when looking at existing things that "I could do this alone much better if I didn't overengineer it so much"
<RX14> just because they know HOW to do it only makes it a bit less hard
<vegai> they actually were able to do that
<Papierkorb_> Sure it's a big deal, but not as big as when you never done anythign like this before
<RX14> Papierkorb_, idk
<alex-edf> Papierkorb_: Yep
<vegai> RX14: if you're a pioneer in the field, it must be a bit easier
<RX14> vegai, yeah a bit
<Papierkorb_> alex-edf: Did that clear it up, or do you have follow up questions?
<RX14> but i would never say its not a big deal
<RX14> or even easy
<RX14> its always hard
<alex-edf> how to convert the endian byte to integer (decimal) and vice-versa?
<Papierkorb_> alex-edf: endianess only applies to multi-byte values. a byte doesn't have an endianess, but an integer (Int32, so four bytes) has
<vegai> go's git repo is a bit funny
<vegai> first commit's timestamp is from 1972
<RX14> lol
<Papierkorb_> alex-edf: in fact, just ignore the whole endianess parameter for now.
<alex-edf> I feel stupid :|
<Papierkorb_> alex-edf: Grab a crystal compiler and try the sample. You can also use the public playground
<alex-edf> I have a message, said '{message:"ls"}' I need to get its length, and write to stdout the endian value
<Papierkorb_> There's IO#write_bytes too for the other direction
<alex-edf> and when reading, read the endian, and convert to decimal to get the message length
<alex-edf> then read the actual message giving the length
<alex-edf> yep but I have a decimal
<alex-edf> said 10
<alex-edf> how to convert to endian?
<alex-edf> and for the other direction
<Papierkorb_> What do different bases have now to do here?
<alex-edf> it's how chrome native messaging works
<Papierkorb_> What, in decimal?
<Papierkorb_> Don't think so
<Papierkorb_> Or rather, your source there doesn't read like that
<alex-edf> message.length is decimal no?
<Papierkorb_> ...no?
<Papierkorb_> it's an integer?
<alex-edf> yep sorry
<alex-edf> i was meaning integer
<alex-edf> :x
<alex-edf> but base 10
<Papierkorb_> Surely not
<Papierkorb_> I'm confident your computer uses base 2 to store it
<Papierkorb_> Base 10 machines died out long time ago
<Papierkorb_> Though I still don't see how bases and endianess are related
<FromGitter> <bararchy> RX14 for me when static compiling , the first Exception just crashes everyting with invalid mem exception
<RX14> oops
<RX14> well aparrently not in my compiler
<RX14> as we've proved
<FromGitter> <bararchy> You used a modified libevent or gc right ?
<RX14> no
<RX14> it just worked
<Papierkorb_> alex-edf: grab a crystal compiler, or the public playground, and just *try* the snippets.
<FromGitter> <bararchy> cool
<FromGitter> <bararchy> I remmber something about unwind not playing nice
Tuxified has joined #crystal-lang
Tuxified has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
Tuxified has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Philpax__ has joined #crystal-lang
sz0 has joined #crystal-lang
claudiuinberlin has joined #crystal-lang
Tuxified has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] asterite opened pull request #4934: Let fun names and method calls start with Uppercase (master...feature/fun-names) https://git.io/v5rU5
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
Philpax__ has quit [Ping timeout: 264 seconds]
snsei has quit [Remote host closed the connection]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
alex-edf has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
Papierkorb_ has quit [Quit: Konversation terminated!]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sz0 has quit [Quit: Connection closed for inactivity]
claudiuinberlin has joined #crystal-lang
claudiuinberlin has quit [Client Quit]
rumenzu has quit [Remote host closed the connection]
<FromGitter> <jwaldrip> So... what is the right way to do this in crystal
<FromGitter> <jwaldrip> [{ "foo" => "bar" }, { "foo" => "baz" }].reduce(&.merge)
<FromGitter> <jwaldrip> as shorthard, I need the next item to be passed as the first arg
<FromGitter> <jwaldrip> `[{ "foo" => "bar" }, { "foo" => "baz" }].reduce { |p, n| p.merge(n) }` would be the longer way
<FromGitter> <jwaldrip> hmm, reading: https://crystal-lang.org/docs/syntax_and_semantics/blocks_and_procs.html seems there is no way
alex`` has joined #crystal-lang
<FromGitter> <Freezerburn> So I've got an interesting problem using HTTP::Client. I'm trying to make an SVN post-hook that leaves a comment on JIRA with information about commits. So I'm trying to get the basics of this working by testing a simple GET via their rest api at the URL "https://mycompany.atlassian.net/rest/api/2/issue/test-issue" which should return a large JSON object. I'm using their basic auth via the
<FromGitter> ... "basic_auth(username, password)" function on HTTP::Client, and setting the "Content-Type" header to "application/json". I create the client with the base url "https://mycompany.atlassian.net" and then use the get function with "/rest/api/2/issue/test-issue". However, when I do this, I'm getting a 404 not found HTML page back instead of the ... [https://gitter.im/crystal-lang/crystal?at=59b17e5b9acddb2407127a87]
<FromGitter> <Freezerburn> (read through the code meaning: I went through the HTTP::Client code and related classes)
<FromGitter> <Freezerburn> Here is a gist including what is effectively being done (actual code slightly different, but use of HTTP::Client is the same): https://gist.github.com/Freezerburn/32f45de652132d94c52c46b83e979d24
<FromGitter> <Freezerburn> The curl command that works: "curl -D- -u 'username:password' -X GET -H "Content-Type: application/json" https://mycompany.atlassian.net/rest/api/2/issue/test-issue"
<Papierkorb> freezeburn, remove the https:// prefix, the c'tor expects a hostname only
<FromGitter> <Freezerburn> @Papierkor: Arrrrgh, can't believe I missed that
<FromGitter> <Freezerburn> At least I have a decent understanding of how the client object works now, I guess
Tuxified has joined #crystal-lang
<FromGitter> <asterite> @jwaldrip `[{"foo" => "bar"}, {"foo" => "baz"}].reduce { |x, y| x.merge(y) }`
<FromGitter> <asterite> Oh, just saw it
rumenzu has joined #crystal-lang
Gasher has quit [Quit: Leaving]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Read error: Connection reset by peer]
sp4rrow has joined #crystal-lang
alex`` has quit [Read error: No route to host]
rumenzu has quit []
Tuxified has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
p0p0pr37 has quit [Remote host closed the connection]
_p0p0pr37 has joined #crystal-lang
Groogy has quit [Ping timeout: 240 seconds]
_p0p0pr37 has quit [Changing host]
_p0p0pr37 has joined #crystal-lang
<FromGitter> <krypton97> Is there any disadvantages using packages that contains c bindings?
<FromGitter> <krypton97> I've tested two image packages and the one that contains c binding tends to be faster
<FromGitter> <luislavena> @krypton97 it might be faster, but if the call to C takes long time, it will block the fiber scheduler from allowing other fibers to work.
<FromGitter> <krypton97> Well, I'ma stick to the crystal one if so
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
Tuxified has joined #crystal-lang
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
rohitpaulk has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite closed pull request #4934: Let fun names and method calls start with Uppercase (master...feature/fun-names) https://git.io/v5rU5
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/v5rSe
<crystal-gh> crystal/master 16be884 Ary Borenszweig: Disallow top-level funs that start with Uppercase
<crystal-gh> crystal/master 952d95f Ary Borenszweig: Let fun names and method calls start with Uppercase
<Yxhuvud> hmm. LLVM 5.0 was just released.
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
Tuxified has quit [Ping timeout: 240 seconds]
<travis-ci> crystal-lang/crystal#16be884 (master - Disallow top-level funs that start with Uppercase): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/273029745
claudiuinberlin has joined #crystal-lang
<Yxhuvud> travis: crash in malloc during parse. Out of memory?
ShalokShalom_ is now known as ShalokShalom
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v5r7q
<crystal-gh> crystal/master 19bb517 Ary Borenszweig: Don't check call of non-self instance when computing read instance vars. Fixes #4830
<FromGitter> <sdogruyol> probably
<FromGitter> <sdogruyol> @drujensen not sure what they resolved at that issue
<oprypin> luislavena, what you said is quite inaccurate
<oprypin> nope, i actually misread it
<oprypin> thing is, the code could take a long time even in Crystal and block the scheduler just the same way
<FromGitter> <crisward> Will LLVM 5.0 have any effect on non-release compile time?
<travis-ci> crystal-lang/crystal#19bb517 (master - Don't check call of non-self instance when computing read instance vars. Fixes #4830): The build was fixed. https://travis-ci.org/crystal-lang/crystal/builds/273041879
<oprypin> well of course it will have "any" effect, the question is how much. also disregard the version jump, it's the same difference as, say, LLVM 3.8 and 3.9
<oprypin> so not likely to have a big effect
<oprypin> only one way to find out
<FromGitter> <crisward> Semver can be a bit misleading at times, the number is always read as a degree of difference, not as a measure of compatibility, which is of course what it is. Someone should come up with a second number based on the number of cool features added. AwesomeVer.
<FromGitter> <fridgerator> +1 for AwesomeVer
<FromGitter> <crisward> You can't +1 AwesomeVer, you have x10 it! 😉
<FromGitter> <opensas> also, very usually minor breaking changes gives the impression of a mayor change
<FromGitter> <jwaldrip> @ysbaddaden & @asterite would you mind reviwing #4838 again?
<FromGitter> <jwaldrip> It still shows as requesting changes.
sp4rrow has joined #crystal-lang
<FromGitter> <jwoertink> Anyone know if there's any MCrypt shard, or if it's built in to crystal?
<FromGitter> <jwoertink> I haven't seen anything
<FromGitter> <sdogruyol> havent seen
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<FromGitter> <jwoertink> Just added to crystal-community. In case anyone is brave enough to take on some cryptography :D
<FromGitter> <sdogruyol> :D
<FromGitter> <luislavena> @oprypin if the C code is a loop, yeah, will be the same. If the code deals with IO, then is different.
<travis-ci> crystal-lang/crystal#19bb517 (master - Don't check call of non-self instance when computing read instance vars. Fixes #4830): The build was fixed. https://travis-ci.org/crystal-lang/crystal/builds/273041879
alex`` has quit [Ping timeout: 246 seconds]
<crystal-gh> [crystal] RX14 closed pull request #4664: Parser: correct parsing 'foo &.%(1)' (master...fix/crystal/parse-percent-as-block-call) https://git.io/vQuCn
<FromGitter> <opensas> a question about style, which is more idiomatic using curly braces or DO .. END, like in ⏎ ´´´ ⏎ x.map_with_index { |value, index| ⏎ [...] ⏎ } ... [https://gitter.im/crystal-lang/crystal?at=59b1c21fee5c9a4c5f4484dc]
<FromGitter> <sdogruyol> If it's a one liner use curly else do end
<FromGitter> <opensas> (oops, couldn't close the code tag), is there some criteria to choose which style to use or is it just personal preference?
<FromGitter> <opensas> @sdogruyol ok, thanks
<FromGitter> <sdogruyol> You're welcome
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/v5rhp
<crystal-gh> crystal/master 3fbdde5 TSUYUSATO Kitsune: Parser: correct to parse 'foo &.%(1)' (#4664)...
<FromGitter> <krypton97> I like that as well
<FromGitter> <krypton97> also the if statement after condition seems a great addition
<oprypin> i don't like that, don't make it one-sided because there's no consensus
<RX14> i added an option to the formatter to force block usage but it was reverted because i need to make both block styles act the same regarding precedent
<travis-ci> crystal-lang/crystal#19bb517 (master - Don't check call of non-self instance when computing read instance vars. Fixes #4830): The build was fixed. https://travis-ci.org/crystal-lang/crystal/builds/273041879
<oprypin> should just remove one of the two syntaxes and be done with it
<RX14> but you know we'd be left with do/end only
<RX14> and that really does look ugly on 1 line
<oprypin> this whole construct is ugly ;/
<RX14> blocks in general?
<oprypin> yeah
<RX14> i disagree strongly
<oprypin> there's probably a good reason why no other language has them
<RX14> the way it makes first-order functions which take functions beautiful is great
<RX14> oprypin, plenty of languages have them
<RX14> or do things like make a special syntax for the last argument being a function
<RX14> blocks are one of the things i like the most about crystal's ruby heritage
<oprypin> RX14, uhm what's the problem with accepting functions as normal arguments?
<RX14> it's uglier
<RX14> you end up with , ->{ ... })
<RX14> which is a LOT of symbol noise
<RX14> and symbol noise is bad
<RX14> ruby's syntax is pretty heavilly based around removing symbol noise
<RX14> and i love it for that
<oprypin> i guess i just like how python de-emphasised the need for passing functions
<RX14> how?
<RX14> ive not used python much
<RX14> for example the sorting by a custom key in python ive seen has always been pretty ugly
<oprypin> it's not so nice, now that I think about it :D
<oprypin> RX14, yeah that's definitely not nice
<RX14> but then i think that python's lambda syntax is ugly
<oprypin> i guess Python just introduced a bunch of language constructs
<oprypin> special syntax for `map`, special syntax for wrapping a block into a cleanup task
<oprypin> special syntax for iteration, for crying out loud :p (`for`)
<RX14> exactly
<oprypin> what I hate above all else is the inversion of control for yielding methods
<RX14> ruby takes that the other way and turns those into functions
<RX14> which are inherently more flexible and composable
<oprypin> whyy should something that just spews a bunch of items out actually take over the control flow
<RX14> you mean break/next?
<oprypin> these are the things that affect control flow drastically, but i mean in general
<RX14> not sure what you mean then
<oprypin> and the number one thing I can't stand coming from Python is the disconnect between `yield` and `Iterator`
<RX14> i rarely use iterators
<oprypin> because they suck
<RX14> i guess
<oprypin> lazy computation is extremely underrepresented. arrays flying around everywhere
<oprypin> at least we have this last bastion of hope https://crystal-lang.org/api/0.23.1/Iterator.html#map%28%26func%3AT-%3EU%29forallU-instance-method
<oprypin> i'm just wondering now -- `{ | | }` and `&.` could really be unified into something different, because together with `do | | end` the variation is way too high for 3 things that act the same
<RX14> yeah
<RX14> i used groovy a lot for a while
<RX14> and it had that
<RX14> if there was no arguments it's just be named `it`
<travis-ci> crystal-lang/crystal#16be884 (master - Disallow top-level funs that start with Uppercase): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/273029745
<oprypin> oh well, this is all fruitless, gotta do less of that
<oprypin> I just hate that I'm not in the position to pitch the idea of `yield` making iterators automatically
<oprypin> I don't know if it's possible and can't implement it
<oprypin> C# has it though
<oprypin> and javascript and python
<RX14> oprypin, im sure its possible
<oprypin> but the latter certainly don't prove the possibility of it in a compiled language
<RX14> and if someone PRed an impl i'd lobby hard for it being accepted
<RX14> but it's simply not *that* important and way down the agenda
<RX14> sounds perfect for post-1.0 for me
<RX14> oprypin, compiled or not doesnt matter
<RX14> the way the javascript compilers do it is to turn the entire methods into a state machine transparently
<RX14> thats not weird dynamic language tricks
<oprypin> RX14, not Python tho
<RX14> yeah
<RX14> but javascript absolutely
<oprypin> Python does use weird dynamic language tricks
<RX14> the ES6 to ES3 transpilers do this
<RX14> and its a source -> source linear transform
<RX14> it *must* be possible
<oprypin> static typing makes it harder tho
<oprypin> type inference
<oprypin> rather
<RX14> how so
<oprypin> well there are many catches like a variable being able to change its type
<oprypin> so you'd probably need to make it into two instance variables or something i dunno
<RX14> doesnt it interact with variable typing in exactly the same way as yield?
<RX14> oh you mean like that uhh we can just save and load all the ivars at the beginning and end i guess
<RX14> and the type will be the union
<oprypin> yield doesn't make the weather, it's storing the state between invokations and resuming loops etc
<RX14> well
<oprypin> in fact, accepting blocks makes this so much harder
<RX14> again, i can't believe it's much different from how javascript does it
<oprypin> you can't just resume a call with a block that loops by rewriting only the original source code
<RX14> oprypin, just inline all the blocks lel
<oprypin> i mean rewriting only the caller's source code
<RX14> well we inline anyway so
<oprypin> RX14, uhhh inine then transform, i guess
<RX14> yep
<oprypin> good point
<RX14> procs would be harder
<RX14> maybe?
<oprypin> but there's also an entirely alternative path - support for this from llvm
<oprypin> RX14, procs could just be sacrificed
<RX14> yeah
<oprypin> > This is a work in progress. Compatibility across LLVM releases is not guaranteed.
<RX14> well
<RX14> id rather do a source transform, that way is probably worse performance
<RX14> at least try this way first
<oprypin> it probably rewrites though
<oprypin> what I also dislike is that syntactically such a feature does not fit in
<RX14> yeah thats the other issue
<oprypin> well it's not too bad. something like `iter def` could define the blockless version for free, OR there could be a symbol for a blockless call like `foo.bar@.to_a`
<FromGitter> <drosehn> *Picked up from @ CodeWisdom on twitter:* "Computer language design is just like a stroll in the park. Jurassic Park, that is." -- Larry Wall
rizo[m] has left #crystal-lang ["User left"]
<FromGitter> <asterite> I'd also like to have yield make iterators. But it's really hard. And blocks, as oprypin mentions, make it even harder. And compile times will be even bigger. I would be OK with an implementation that used fibers to suspend the execution... at least that's how it's done in Ruby and nobody complains (but probably because the performance of that is on par with everything else). But I don't know how to implement
<FromGitter> ... that either...
<RX14> well with fibers you just spawn a new fiber and pass the method a block which sends the item to a channel
<RX14> it's doable rn with the stdlib
<RX14> making it efficient is the hard bit
sp4rrow has joined #crystal-lang
<FromGitter> <asterite> Yes, but using channels is very slow. I think it shouldn't be necessary. When you call `next` you'd resume that fiber, and `yield` would pause it... somehow... I don't know :-P
<oprypin> people are gonna ignore a feature with such a big performance hit
<RX14> are channels really so slow or is it the fiber switches?
<FromGitter> <asterite> I mean, Enumerator with channels is definitely possible, I was able to do it. But it's slow. Maybe we could start with that, at least, and hope that later the performance will improve
<FromGitter> <asterite> Ah, yes, fiber switches are slow
<oprypin> asterite, yield would just wait on a channel(nil)
<oprypin> and next would send to it
<FromGitter> <asterite> I don't think performance matters much. Probably other things matter... Ruby is relatively slow but still fast enough for most web things, for example. If you have something slow you rewrite it with a faster construct (in Ruby that's not always possible unless you drop to C)
<RX14> i think performance matters in crystal though
<RX14> we're a language built with a message about performance
<FromGitter> <asterite> Yes, but for example Rust is more performant
sp4rrow has quit [Client Quit]
<RX14> taking the stance that performance doesn't *really* matter in the stdlib will likely get us bad PR somewhere down the line
<FromGitter> <asterite> Yeah... probably
<FromGitter> <asterite> That's why there's no magic iterator so far :-P
<oprypin> stdlib simply wouldn't use this then......
<RX14> yeah rust is faster but i'd imagine thats mainly to do with their custom IR lowering and opt steps, and the lack of GC
<RX14> mostly the latter i'd guess
<oprypin> asterite, the thing is though, such a feature would not be used often for blocks in blocks. it's just a neat abstraction for a state machine
<RX14> in pure numerical or struct-based code i don't imagine we'd be different from rust
sp4rrow has joined #crystal-lang
<oprypin> incremental/cached compilation would certainly help with compilation times
<travis-ci> crystal-lang/crystal#3fbdde5 (master - Parser: correct to parse 'foo &.%(1)' (#4664)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/273071403
<FromGitter> <asterite> RX14: for iterators, Rust can avoid allocating them at all and then compile to very efficient instructions. In our case when iterators are class-based it's kind of impossible. Unless... someone implements a good escape analysis algorithm for Crystal :-P
<oprypin> but yeah, if even for you it's really hard, then i dunno
sp4rrow has quit [Client Quit]
<RX14> @asterite we're too used to you doing the impossible lol
<oprypin> lol
<RX14> i think blocks are crystal's 0-cost abstraction
<oprypin> asterite, curiously enough, this feature could be the gateway to some easy optimizations
<FromGitter> <asterite> RX14 lol
<RX14> for iteration we're already on par with rust with nice semantics but it's the mutation chains that are the issue
<oprypin> you could inline its usages as well
<RX14> because all the map blocks which can be inlined (i.e. not iterators) are creating new arrays
Philpax__ has joined #crystal-lang
<RX14> also with the iterators being class-based im not sure how this would work because we just capture the block
<oprypin> ?
<RX14> we just immediately capture the block
<RX14> which is likely to immediately defeat LLVM's optimiser
<oprypin> well don't do that then
<RX14> how lol
<oprypin> see this is where inversion of control hurts the most
<oprypin> hmm yes this could be the hardest part
<oprypin> RX14, maybe you can't easily inline that, but actually i don't see the problem with the linked line
<oprypin> this is just a function that returns something that stores the old iterator and the function
<oprypin> and if it's replaced with an iter def this could be more easily inlined
<oprypin> if I wasn't clear enough, what I'm trying to say here, this feature doesn't have to stop at just being sugar for Iterator
<oprypin> it would make it easier to skip the middle man
<FromGitter> <faustinoaq> > we don't use any formal BNF. [0] ⏎ ⏎ So, How Does Crystal parser work? Do you use a pseudo BNF (http://www.softlab.ntua.gr/facilities/documentation/unix/ruby-man-1.4/yacc.html) or something similar (https://www.cse.buffalo.edu/~regan/cse305/RubyBNF.pdf)? ⏎ ⏎ [0] - https://github.com/crystal-lang/crystal/issues/4757#issuecomment-319323768 [https://gitter.im/
<FromGitter> ... crystal-lang/crystal?at=59b1d91966c1c7c47728169c]
<RX14> @faustinoaq just a manually written lexer and parser
<RX14> it's really not hard to do without tools
<RX14> lexing is easy you just nest case and add a few edge cases
<RX14> parsing you take tokens and costruct ast nodes by hand using recursive descent
<RX14> essentially just recursive method calling
<oprypin> the lexer would be nice to replace with a grammar tho
<oprypin> those char-by-char case statements get old quickly
<RX14> the real nasty is in the parser though
<oprypin> :/
<FromGitter> <faustinoaq> RX14: Ok, I understand now, So a parser for Crystal using a grammar and tools like flex/bison would be very hard to do.
<RX14> it might be
<RX14> nobody knows
<RX14> it might not be hard
<FromGitter> <faustinoaq> Well, I think a custom lexer and parser allow to write Crystal without C 😅 Ruby and Python are mainly C code.