<FromGitter>
<Qwerp-Derp> Is there a proposal for placing Crystal in the JVM and CLR?
<RX14>
no
<FromGitter>
<Qwerp-Derp> I'm guessing doing so wouldn't be a good idea anyway, but I would definitely like to use Crystal in those environments
<RX14>
im sure if crystal ever reaches 1.0 there might be some impls
<FromGitter>
<Qwerp-Derp> Hmmm, yeah
<FromGitter>
<Qwerp-Derp> Should I put an issue into the main repository for this, or would that not be a good idea?
<crystal-gh>
[crystal] Sija opened pull request #5657: Make <code> behave more like <pre> in terms of linebreaks (master...fix-docs-code-css) https://git.io/vN9mo
<FromGitter>
<bew> I think it's not worth to think ahead about aalll the things we'll be able to do once it reaches 1.0, and let's not clutter the issue tracker with sth that's not even an issue
duane has quit [Ping timeout: 240 seconds]
andrewzah has joined #crystal-lang
andrewzah has quit [Client Quit]
andrewzah has joined #crystal-lang
andrewzah has quit [Client Quit]
andrewzah has joined #crystal-lang
andrewzah has quit [Client Quit]
andrewzah has joined #crystal-lang
andrewzah has quit [Client Quit]
andrewzah has joined #crystal-lang
andrewzah has quit [Client Quit]
sz0 has quit [Quit: Connection closed for inactivity]
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
never has joined #crystal-lang
hightower3 has quit [Ping timeout: 240 seconds]
never has quit [Ping timeout: 256 seconds]
duane has quit [Ping timeout: 240 seconds]
never has joined #crystal-lang
<FromGitter>
<elorest> Is there a way call super on a method with a different name? For instance say I've already over written and method. How would I call that method from a different method? ⏎ ⏎ For instance ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a700c10ac509d207d94d874]
<FromGitter>
<HCLarsen> super.name maybe?
<FromGitter>
<HCLarsen> I'm guessing, I
<FromGitter>
<elorest> That calls name on the return value of super.
<FromGitter>
<HCLarsen> I'm not certain about that at all.
<FromGitter>
<elorest> Obviously my demo code above doesn't make any more sense.
<FromGitter>
<HCLarsen> It makes sense. You might just have to rethink your method names.
<FromGitter>
<aisrael> ☝️ Is that some new functionall programming language?
<FromGitter>
<bew> lol it's a vim command
<FromGitter>
<elorest> I have that leader command that lets my just type my query in as a line in my file (/search/replace/)... (weird in know)
<FromGitter>
<HCLarsen> Still easier to read than JavaScript.
<FromGitter>
<bew> lol x) @HCLarsen
<FromGitter>
<elorest> LOL. Javascript isn't really that hard if they weren't obsessed with accomplishing in 200 lines what they could in 10.
<FromGitter>
<elorest> @bew for some reason your suggestion still returns the result of the child classes overloaded method.
<FromGitter>
<HCLarsen> I love joking about JavaScript, because it was honestly the hardest language for me to learn. I often joke that I had an easier time learning Assembly Language.
<FromGitter>
<bew> hum don't think it's possible then @elorest
<FromGitter>
<elorest> Thanks anyway.
<FromGitter>
<elorest> @HCLarsen I feel like i've learned Javascript multiple times. But unlike rails or even java best practices, libraries and even syntax change so fast.
<FromGitter>
<elorest> Back in 2004 I thought I was pretty good at JS lol.
<FromGitter>
<elorest> Then again in like 2013 with Ember.
<FromGitter>
<HCLarsen> I only first learned JavaScript a couple of years ago, so I've only had to relearn with ES6. To be fair to the community, ES6 is a SEVERE improvement.
<FromGitter>
<elorest> Yeah definitely but I don't know if "The Community" get the credit for that.
<FromGitter>
<elorest> That's more like our browser overlords.
<FromGitter>
<HCLarsen> Yes. It's ironic that the local JS community here does nothing but condemn OO programming, but ES6 tends to make JS work more like an OO language.
<FromGitter>
<elorest> Yeah I work downstairs from a huge Elixir company too.
<FromGitter>
<elorest> Its interesting though because they're going on year 3 with Phoenix and they're running into a ton of problems they were convince only Rails had.
<FromGitter>
<elorest> New programming languages don't fix code debt introduced by tight deadlines and poor planning.
<FromGitter>
<HCLarsen> Yeah, Elixer seems to be popular in the local Ruby community, but I don't see any particular advantage over Rails. I'm putting my eggs in the Crystal basket.
<FromGitter>
<elorest> And code written to solve a simpler problem a year ago doesn't always expand well of fit a much more complex problem even when its "functional."
<FromGitter>
<elorest> Yeah for me its not nearly fast enough to put up with all the weird syntax. 2.5x faster than ruby to but slower to program in isn't worth it to me.
<FromGitter>
<HCLarsen> I really don't see much truth in the argument that functional is better than OO. Many of the points I've heard made in that argument are either questionable, or full out false.
<FromGitter>
<aisrael> @HCLarsen Oh, you’re the guy on LinkedIn, too. Yeah, so I’m not counting out FP just yet. I’ve been hearing from folks that they found Elixir easier to learn than Go, even. But we ourselves are picking Crystal.
<FromGitter>
<elorest> Functional makes you think about issues in a different way. Back when I was doing C I thought a lot differently than I do now.
<FromGitter>
<HCLarsen> I'm old school. Learned to code with C and C++ back in 1997. Ruby was my first interpreted language. I've never been very comfortable with running my code in an interpreter, or using duck typing, so Crystal fixes all of that for me.
<FromGitter>
<elorest> I'm not saying that's good. But often times with ruby and even crystal a functional solution could be better be people create an initialize objects instead of just calling a simple module function. ⏎ ⏎ Both serve their purpose, but functional only languages in 2018 don't make sense to me.
<never>
I really love Haskell though.
<FromGitter>
<HCLarsen> The arguments I've heard in favour of Functional Programming relate to memory usage (the claim that OO languages can't use value types), or that you can't do testing in OO.
<never>
My only complaint about it is the same as with Rust - I feel incredibly tightly bound.
<FromGitter>
<aisrael> (Believe or not am older school than you, then.) But yeah, one thing that turned us off from Elixir is that it doesn’t really do compile-time type checking. OTOH, we have Crystal’s type inference to be thankful for.
<FromGitter>
<elorest> Yep.
<FromGitter>
<elorest> Well written functional code CAN be more memory efficient than well written OOP in some cases all else being equal.
<FromGitter>
<marksiemers> @elorest - Not sure if this is as elegant as you want: https://carc.in/#/r/3h9m
<FromGitter>
<marksiemers> But it works for that example
<FromGitter>
<HCLarsen> Yes, but the claim I've heard made (in two separate instances) was that functional programming uses value types and OOP uses reference types.
<FromGitter>
<elorest> In many cases it isn't though and functional language often times lead to way too many global vars and ENV to store values since instances don't work.
<FromGitter>
<elorest> Hmmm. I don't think that that's true accross the board for either. But it's been 12 years since college so what do I know.
<FromGitter>
<aisrael> How different is that from “average” Java devs in “average” Java shops using global static instance vars everywhere?
<FromGitter>
<HCLarsen> Well, off the top of my head, I can list Objective-C, Swift and Crystal as OO languages that use both.
<FromGitter>
<elorest> Because that's just bad practice. In functional it's the only way to make it work ;)
<FromGitter>
<elorest> @marksiemers I responded to you in ambe.
<FromGitter>
<aisrael> @elorest Not an Elixir expert but I believe you’re supposed to use `GenServer`s and/or actors
<FromGitter>
<marksiemers> There are too many times that you need to store state to have a fully FP language meet all your needs. ⏎ In Elixir, you end up storing state by basically spawning a process that just runs in a loop will return certain information as a message.
<FromGitter>
<elorest> Still technically storing values on global constant lol.
<FromGitter>
<marksiemers> Which is a super hacky way to store state.
<FromGitter>
<HCLarsen> Yikes.
<FromGitter>
<marksiemers> Erlang has the fault tolerance thing down though, and I think the "stateless" nature of it allows that
<FromGitter>
<elorest> Erlang is great for phone switch boards lol.
<FromGitter>
<HCLarsen> Apparently Erlang is very popular in the telecom industry, for low level stuff.
<FromGitter>
<marksiemers> It is really good for zero downtime, and hot-swappable code deploys
<FromGitter>
<marksiemers> Erlang is short for Ericson Language - as in Sony Ericson. It was built by telecom ppl
<FromGitter>
<aisrael> That’s the other thing that made us choose Crystal. These days, we use containers and K8s for that.
<FromGitter>
<HCLarsen> I hear concurrency is a natural strength of Erlang as well.
<FromGitter>
<marksiemers> and I think it runs a huge percentage of the telco world
<FromGitter>
<marksiemers> yes it is
<FromGitter>
<elorest> Yeah that hotswappable thing seems pretty cool. Wouldn't be that useful for webservers but perhaps websockets could make use of it.
<FromGitter>
<marksiemers> the fault tolerance and concurrency go hand-in-hand
<FromGitter>
<HCLarsen> Ahhh
<FromGitter>
<marksiemers> its just a bunch of nodes - they can be on any machine
<FromGitter>
<HCLarsen> I chose Crystal because I want the deployability and efficiency of C, with the beauty of Ruby code.
<FromGitter>
<marksiemers> if one goes down, then somewhere in the supervision tree, it will get replaced
<FromGitter>
<elorest> In a way we could largely do that with ruby, crystal or a ton of other languages though.
<FromGitter>
<elorest> Just spawn a bunch of processes and load balance.
<FromGitter>
<aisrael> That’s what am thinking. That’s not a language feature *per se*. Isn’t that just the supervision tree and actor model (which could theoretically be implemented in Crystal)?
<FromGitter>
<elorest> In erlang it is a language feature.
<FromGitter>
<marksiemers> Erlang has it pretty seamlessly in the language - it does it really well.
<FromGitter>
<elorest> But it doesn't necesarily have to be to get the same utility.
<FromGitter>
<aisrael> Ahh.
<FromGitter>
<marksiemers> I think it may be the only language to get to nine 9's of availability
<FromGitter>
<marksiemers> But crystal is faster and so much more fun to work with
<FromGitter>
<marksiemers> I mean, Elixir is Erlang in the same way that Crystal is LLVM bytecode
<FromGitter>
<elorest> Yeah also it sort of depends on what it is and how many process it can grow too.
<FromGitter>
<elorest> You can still DDOS an erlang app.
<FromGitter>
<HCLarsen> It's also a matter of hardware, right? I mean, once you get past the number of cores, concurrent processes are just multiplexed through the same cores.
jnyw has quit [Ping timeout: 240 seconds]
never has quit [Remote host closed the connection]
never has joined #crystal-lang
<FromGitter>
<marksiemers> At some point, yes hardware matters. The part that Erlang does well is abstracts whether or not processes are running on the same machine or over a network.
<FromGitter>
<marksiemers> So in some cases an actual machine can go down, and there will still be zero downtime
<FromGitter>
<marksiemers> And the processes are lightweight, not limited to number of processors - like they claim millions of concurrent processes on the same machine. Which does't add to parallel speed, but does offer a lot of backup processes if something goes wrong with any of them
<FromGitter>
<marksiemers> And since there is no "state" you don't have to worry about state transfer if a process goes doewn
<FromGitter>
<watzon> When defining an abstract class can you define an abstract class variable in the same way you can an abstract method?
<FromGitter>
<bew> you can't do abstract class methods (because there is no "instance" to call them on), and there is no such thing as abstract instance variables, why/how would there be abstract class variables?
<FromGitter>
<bew> @watzon ^
<FromGitter>
<watzon> I guess I'm kinda trying to do an interface in Crystal haha
<FromGitter>
<watzon> That's one thing that I feel Crystal is missing. Hope it gets added.
<FromGitter>
<bajro17> for what you need interface?
<vegai>
for implementing architect astronauts' grand designs? :P
<FromGitter>
<bew> well, from the docs, it should decode the string as hex string (high nibble first)
<FromGitter>
<bew> why do you need this?
<FromGitter>
<bew> where does that string come from?
<FromGitter>
<watzon> I just want to convert a string to its hex representation
<FromGitter>
<bew> `"ab".to_slice.hexstring`
<FromGitter>
<bew> => `"6162"`
<FromGitter>
<bew> like this?
<FromGitter>
<watzon> Perfect
<FromGitter>
<watzon> Thanks :)
codenoid has joined #crystal-lang
<FromGitter>
<bew> @alex-lairan not sure I can help you with the informations you gave, can you try to give a reproducible smaller example, in carc.in or another code sharing site?
<codenoid>
helo, how to create global hash ?
<FromGitter>
<bew> Yes why?
<codenoid>
how
<FromGitter>
<bew> I mean, with a constant, of a class variable in a module
<FromGitter>
<bew> (Of in a class)
<FromGitter>
<bew> Or*
<codenoid>
yeah
<codenoid>
yay, i dont need redis anymore
<codenoid>
* i define constant outside module @bew, :+1:
<FromGitter>
<ShriekBob> On a random note about a conversation that happened earlier, I quite like the way go does interfaces. The...I don't know how you would describe it...specified duck typing? Like you create the interface, you specify that you take an interface, but you don't have to specify that you implement the interface, you just have to implement it
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
<greenbigfrog>
`def sth(a : String, b : Int32? = nil)` I bet there is a nicer syntax for this I can't think off right now...
<codenoid>
it's a sexy syntax for me
<oprypin>
ShriekBob, you can do the same in crystal, without even creating an interface :D
<oprypin>
or with, by using a module+abstract, but then you do declare it, which is nice
<greenbigfrog>
yes, it's sexy and on point, but IIRC there's a even nicer way to write it
<oprypin>
greenbigfrog, i dont know what can be nicer
<FromGitter>
<ShriekBob> Oh I know you can duck type in crystal, like in Ruby, but I'm fond of the idea that you can specify "this function takes a Reader" where "Reader" is any class that implements Read()
<FromGitter>
<ShriekBob> Like I said, I've been fiddling with Go, and it's definitely one of the thing I've liked
<FromGitter>
<codenoid> how to pass that, i think the problen in `ctx.response.print`
<FromGitter>
<ShriekBob> the idea that you can go "oh hey, theres a pattern here, let's define an interface, but hey I also don't have to go back and edit all those classes"
<FromGitter>
<codenoid> `Invalid Int32`, wat, i dont write /Cast Int32
<FromGitter>
<marksiemers> @ShriekBob - I would hesitate to say "you can duck type in crystal." Even when you let type inference take care of everything and the code looks like ruby, it is still statically typed - it just uses union types. The effect is very similar but to me, "duck typing" means that the method doesn't actually care what type it is, as long as it responds to the correct methods/operators at run-time. ⏎ Type
<FromGitter>
... inference cares at compile-time, and the compiler builds a method to take the specific types that are used in the program.
<FromGitter>
<ShriekBob> Sure, that's again, part of the benefit of interfaces though, less union types, it's all a bit more implicit
<FromGitter>
<ShriekBob> Given that, I would imagine, the compiler could go "all these implement Read, and there is an interface that defines Read, therefore these are all Readers"
<FromGitter>
<marksiemers> Indeed, my thoughts are about semantics more than anything, but when you get into the differences between crystal and ruby - semantics are important.
<FromGitter>
<ShriekBob> Either way, I just think it's a neat language feature, defining an interface, but not having to declare you implement it, just implementing it
<FromGitter>
<ShriekBob> Sure
<FromGitter>
<marksiemers> yeah - the things you can do with the type system and type inference are huge benefits of crystal
<FromGitter>
<codenoid> should i report this "bug" (?)
<FromGitter>
<ShriekBob> Indeed, it is, but, would inference be clearer if you could actually specify the interface?
<FromGitter>
<codenoid> me ?
<FromGitter>
<ShriekBob> No, that was @marksiemers
<FromGitter>
<ShriekBob> and yeah, I'd repor it @codenoid
<FromGitter>
<ShriekBob> even if it's not a bug, someone with more knowledge can check and qualify
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qard has joined #crystal-lang
qard has quit [Client Quit]
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
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
qard 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
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
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
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
dragonkh has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
theTypeTyper75 has joined #crystal-lang
<theTypeTyper75>
I have a method where I need to specify named arguments. And one of these named arguments is the "length" that i need to specify, it needs to be "UInt32?". So I tried "length: 100". But this doesnt works like at the other named argument. Which just needed to be "String". Not "String?". What should I do at these questionmark-types?
snsei has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<bajro17> how to create multidimensional array in crystal?
<FromGitter>
<bajro17> I find solution with [[][]]
<FromGitter>
<Dillybob1992> :D
<FromGitter>
<ShriekBob> Quick question, I assume you don't need to compile the whole compiler to change the crystal command to use a new version of spec?
<FromGitter>
<ShriekBob> Also, man, running Crystal Spec on crystal itself is real slow to give output
codenoid has quit [Ping timeout: 264 seconds]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<bajro17> is it possible to create new array with number of rows and of columns like Array.new(3,3)
snsei has quit [Remote host closed the connection]
qard has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<ShriekBob> While I've got you, I assume said make file describes how to make the crystal binary (if I'm looking to change spec, say...so I can test changes)
<oprypin>
ShriekBob, well sure, that's just `make`
<FromGitter>
<ShriekBob> Yep, thought so, just wanted to check
<oprypin>
and you dont exactly got me unless you ping me
<oprypin>
so that was lucky
<FromGitter>
<ShriekBob> it was
jnyw has joined #crystal-lang
dragonkh has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<FromGitter>
<ShriekBob> Man, the crystal compiler, when it compilers itself, really needs more verbose output. I have no idea if it's compiling, or some setup on my machine has made it hang
<Papierkorb>
The crystal compiler is a good UNIX program: It keeps silent if there's nothing to say.
<Papierkorb>
If it consumes CPU, it's running
<FromGitter>
<ShriekBob> I assume then, that when I run spec, it won't say anything until all tests are complete, then it'll output?
<Papierkorb>
No, it's compiling. spec outputs data continously once it's running
<Papierkorb>
Depending on your hardware, compiling the test suite can take a considerable amount of time
<FromGitter>
<ShriekBob> Cool, good to know, thank you
<Papierkorb>
The test lib the compiler uses is the same as you'd use. It'll output green dots for each successful test, and a red F for failed tests. None should fail, a handful will be "pending"
moei has quit [Quit: Leaving...]
<FromGitter>
<watzon> What would be a good way to take an array with a number of elements that's divisible by 128 and zip it into 68 element chunks?
<FromGitter>
<watzon> Is there a method on enumerable or iterable already that can do this?