jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.18.7 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
tubbo has quit [Ping timeout: 240 seconds]
ponga has joined #crystal-lang
<FromGitter> <binary132> o/
<apotheon> BlaXpirit: Does Crystal have each_with_index?
<apotheon> BlaXpirit: I wonder if you could clean up some of your code sample with that (having just glanced at it).
ponga has quit []
pawnbox has joined #crystal-lang
onethirtyfive has joined #crystal-lang
Philpax has quit [Ping timeout: 258 seconds]
Philpax has joined #crystal-lang
bjz has joined #crystal-lang
<BlaXpirit> apotheon, has each_with_index, and I don't think it applies
<crystal-gh> [crystal] jhass pushed 1 new commit to master: https://git.io/v6zq3
<crystal-gh> crystal/master 7ac9a53 David Alexander: Checks if cookies is empty before adding to header (#3150)...
<travis-ci> crystal-lang/crystal#7ac9a53 (master - Checks if cookies is empty before adding to header (#3150)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/152159332
pawnbox has quit [Ping timeout: 264 seconds]
pawnbox has joined #crystal-lang
triangles has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
<FromGitter> <ssaatya> Hello
<RX14> hi
<FromGitter> <ssaatya> I'm getting undefined constant HTTP when i do
<RX14> did you require http?
<FromGitter> <ssaatya> include HTTP
<RX14> include != require
<RX14> they have completely different uses and effects
<FromGitter> <ssaatya> yes i can require http but i cannot include in a class
<RX14> why do you want to?
<FromGitter> <ssaatya> i want to include http in class
<RX14> to do what, you shouldn't need to include HTTP...
<FromGitter> <ssaatya> but without inclusion i'm getting undefined constant
<RX14> can you show me come code?
<FromGitter> <ssaatya> class AUR ⏎ include HTTP ⏎ def searchPackage(package, by : String = "name-desc") ⏎ url = "aur.archlinux.org/rpc/?v=5&type=search&by="+ by + "&args=" + package ⏎ res = HTTP::Client.get url ... [https://gitter.im/crystal-lang/crystal?at=57b0440246a301fa5a4daca6]
<RX14> you can use ``` markdown formatting to have code blocks in gitter
<FromGitter> <ssaatya> class AUR ⏎ ⏎ def searchPackage(package, by : String = "name-desc") ⏎ url = "aur.archlinux.org/rpc/?v=5&type=search&by="+ by + "&args=" + package ⏎ res = HTTP::Client.get url ... [https://gitter.im/crystal-lang/crystal?at=57b0442d46a301fa5a4dacc7]
<RX14> you don't need to include HTTP to use it
<FromGitter> <ssaatya> but without inclusion i'm getting undefined constant
<RX14> you probably havent required it then
<RX14> require "http" at the top of the file
<FromGitter> <ssaatya> Actually i want to include it in a class
<RX14> i'm pretty sure you don't
<RX14> the HTTP module isn't a mixin
<FromGitter> <ssaatya> k
<RX14> BlaXpirit, you run FromGitter right? Can you extract code pastes from gitter and upload them somewhere like gist please, because linking to the gitter message is a bit of a pain.
<RX14> @ssaatya that code should work if you require http, and without the include
<FromGitter> <ssaatya> Ok thanks
<BlaXpirit> RX14, i'm concerned about spamming gist from one ip address
<BlaXpirit> also it's more permanent than people on gitter may intend
<jhass> we repaste pastebin.com to gist in #ruby
<jhass> hasn't been any issue
<tilpner> Their rate limit is not an issue for low-volume channels.
<jhass> just be defensive about it and fallback to the gitter link in the case of any error
pawnbox_ has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
<BlaXpirit> and it's so common for people to not even use code formatting
<BlaXpirit> and the ninja edits - that's the worst
<BlaXpirit> I do believe the current state is better
<BlaXpirit> oh and syntax highlighting
<BlaXpirit> much better to greet gitter users with some guidelines, like "your edits aren't seen" "use gist for pastes"
pawnbox_ has quit [Ping timeout: 258 seconds]
pawnbox has joined #crystal-lang
ocast has joined #crystal-lang
<ocast> Hi -- trying to install crystal from source on void-linux (if that matters), and I get the following error: g++: error: /void-packages/common/environment/configure/gccspecs/hardened-cc1: No such file or directory
<ocast> I've heard reports from others that having -specs in the llvm-config --cxxflags output is what causes this, but I'm unclear how to affect that.
<ocast> Any thoughts?
pawnbox has quit [Ping timeout: 252 seconds]
pawnbox has joined #crystal-lang
<RX14> BlaXpirit, it's just that to see the gitter links I have to join the room then i get pinged both on irc and gitter which is annoying
<BlaXpirit> join? well that sucks
<RX14> ocast, this seems to be more of a void linux issue than a crystal one
<ocast> RX14, Ah. Any ideas on where I can look, potentially?
<ocast> (BRB)
<BlaXpirit> i think the gitter join message is the most important step to take
<BlaXpirit> ocast, how can we have ideas if crystal works well, nothing like that error message ever comes up, and we know nothing about your system
<RX14> ocast, i suggest asking somewhere void linux related, maybe a void linux irc or mainlking list or forum
ocast has quit [Ping timeout: 244 seconds]
<RX14> ocast, it's an error compiling a C++ library which simply depends on llvm, which means it's a problem with the build environment on void linux most likely.
<FromGitter> <kofno> I'm trying to make a docker file for building scry and testing scry on Travis. Getting this llvm error: https://gist.github.com/kofno/654dfa4504889ae5e32f461bcb69c2e9. ⏎ ⏎ Here's the dockerfile: https://github.com/kofno/scry/blob/master/Dockerfile
<RX14> @kofno why don't you use the crystal docker image?
<RX14> or at least read it
<FromGitter> <kofno> Ok. I'll look. Thanks.
<RX14> FROM crystal-lang/crystal should be what you need, if a little large
<RX14> oh
<RX14> crystallang/crystal
<jhass> kofno: I'd actually recommend you to base on our CI images: jhass/crystal-build-x86_64:llvm38 currently (I will push it to latest after crystal 0.19 was released)
<RX14> jhass, why not the official ones?
<jhass> because they don't include LLVM iirc
<jhass> not 3.8 anyway
<RX14> well the latest crystal release can't use llvm 3.8 so...
<jhass> I have no idea what dockerfile crystal-lang/crystal is, why we have two in the repo and what their intended purposes are anyway
<BlaXpirit> RX14, i think kofno's project needs LLVM so it would be one less step?
<RX14> ohh
<RX14> yeah i didn't realise what scry was
<jhass> kofno: so you can use jhass/crystal-build-x86_64:latest to test against LLVM 3.5 and the llvm38 tag to test against 3.8
<jhass> you shouldn't need anything else but be able to use it directly
<FromGitter> <kofno> That's awesome. Thanks. Will try when I get back to my laptop.
<RX14> i'm a bit reluctant to believe that the compiler internals code can ever be used to build an IDE because the compiler is built to assume correct code and an IDE has to deal with partial code...
<jhass> well, the compiler needs syntactically correct code to assert semantic correctness, if you can live without semantic hints on syntactically invalid codes, why not?
<RX14> but thats not ok
<RX14> you can't just stop completing because you left out an end
<RX14> thats not a good IDE
<jhass> I think it's good enough as a first step
<BlaXpirit> "left out" doesn't sound too convincing
<BlaXpirit> more convincing would be "haven't yet typed a closing bracket"
<jhass> reimplementing all that stuff takes a lot more time
<RX14> BlaXpirit, well thats what I meant
<jhass> and you can do things like use a cache from the last valid time for completion
<RX14> the only way to do something like this i think is to do what typescript have done by including the completion server and code into the core project
<RX14> so that compiler code is written with completion in mind
<BlaXpirit> for sure
<RX14> but i don't think that's really feasible at this point in crystal's life
<RX14> it would slow down compiler work when it's still evolving
<BlaXpirit> seems like the YAML parser reads numbers as strings?
<FromGitter> <kofno> There's still a lot that scry can offer right now. When crystal stabilizes as a target, we can look then a handling completion for files that are incomplete.
<crystal-gh> [crystal] jhass opened pull request #3153: HTTP::Request#path: fallback to / (master...http_request_path) https://git.io/v6z8u
<crystal-gh> [crystal] ysbaddaden pushed 2 new commits to master: https://git.io/v6z4j
<crystal-gh> crystal/master bcabaef Jonne Haß: HTTP::Request#path: fallback to /
<crystal-gh> crystal/master 2751252 Julien Portalier: Merge pull request #3153 from jhass/http_request_path...
ocast has joined #crystal-lang
<FromGitter> <sdogruyol> This is pretty cool presentation about Crystal, from a Rust user https://www.youtube.com/watch?v=tAw5puTcGhA&feature=youtu.be
Philpax has quit [Quit: Leaving]
onethirtyfive has quit [Read error: Connection reset by peer]
onethirtyfive has joined #crystal-lang
<travis-ci> crystal-lang/crystal#2751252 (master - Merge pull request #3153 from jhass/http_request_path): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/152207560
<BlaXpirit> didnt like
<FromGitter> <Sija> @BlaXpirit why not?
<FromGitter> <Sija> it's pretty introductory so you might find it a bit boring but for newcomers might be moar interesting
pawnbox has quit [Remote host closed the connection]
<BlaXpirit> no, it's just not convincing
<BlaXpirit> presenter omits important details, makes mistakes
<BlaXpirit> there is little information in quite a lot of time
<BlaXpirit> i think the mandelbrot set was never shown, what a tease :o
<jhass> you still don't get how these presentations work :P The goal isn't to educate people but to get them interested into the topic
<BlaXpirit> well it doesn't get them interested
<BlaXpirit> it's quite important to show that type annotations CAN be used, but i don't think they were once
<jhass> well he added one to property while he had initialize misspelled
<BlaXpirit> the property thing looked very magical by the way, people may not like it
<BlaXpirit> as did the .is_a? syntax without using brackets
<BlaXpirit> people will think wtf kind of syntax for an operator is `.is_a?`
onethirtyfive has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<apotheon> BlaXpirit: After looking at it for another ten seconds, I see you're right about each_with_index not working out -- even for y, because of `y += value`.
<apotheon> BlaXpirit: sorry for the noise
<BlaXpirit> oh, no problem at all! thanks for looking
ocast has quit [Ping timeout: 244 seconds]
<apotheon> welcome
<apotheon> BlaXpirit: It's difficult to sort through the code, mentally, in part because I have no clue what x, y, w, and h are meant to represent, so it's a bit tough to think about design.
<FromGitter> <Sija> @apotheon x,y coords and w,h for width/height? :)
<BlaXpirit> http://bit.ly/2aLLBWt -> Raw data
<FromGitter> <kofno> I finally got a chance to try jhass/crystal-build-x86_64:latest in my dockerfile and I still get errors trying to run crystal spec on scry. :( ⏎ ⏎ https://gist.github.com/kofno/7caa9ae35cfaefc691de5b97b363d47b
<BlaXpirit> kofno, i seem to remember these things from a LLVM version mismatch
<BlaXpirit> kofno, fwiw it's this exact error message https://github.com/crystal-lang/crystal/issues/2393
<FromGitter> <kofno> I saw that issue, but I guess I'm not sure how to apply that to my docket config.
<apotheon> @Sija - Of course, I should have realized. Those are the obvious meanings of those letters.
<FromGitter> <Sija> @apotheon: You're welcome! ;)
<apotheon> BlaXpirit: I'd assume (of course) that Crystal uses IEEE 754 floating point numbers as a standard data type, but please correct me if I'm mistaken in that assumption. Does it also have a built-in decimal type that is easy to use and doesn't suffer from rounding errors, well-integrated with the language so that, for instance, lengthy lines of code aren't required to perform simple operations
<apotheon> (e.g. arithmetic)?
<BlaXpirit> apotheon, uses normal floats like you said, yes. also has decent wrappers for GMP
<BlaXpirit> maybe https://crystal-lang.org/api/0.18.7/BigFloat.html does what you're talking about. I sure hope so, at least
<apotheon> Maybe.
<BlaXpirit> operator overloading is there so it's not tedious to use but there are no arbitrary precision literals
<apotheon> Hm. It looks like it has a precision default. That doesn't sound like a float at all.
<BlaXpirit> that's what confused me too
<apotheon> Ruby's BigDecimal should have been called FixedImprecisionDecimal or something like that.
<apotheon> It's amazing how many places on the internet have identified BigDecimal as something to use when you want fixed precision decimal numbers without rounding errors when BigDecimal is anything but lacking rounding errors.
<RX14> can you even have a float datatype that's totally lacking imprecision without an arbitrarily large amount of ram?
<apotheon> The fixed precision numeric types without rounding errors provided by libraries in Ruby, that I've seen, are generally pretty unpleasant to use.
<apotheon> RX14: You could have a float lacking imprecision up to the limits of RAM, though the main reason for IEEE 754 with its rounding errors is performance.
<RX14> yes but you generally don't want your floats to use all of your ram
<RX14> you set the imprecision so that your memory usage is well bounded to number size
<apotheon> I'd like to see a trend in languages that come with IEEE 754 *and* some kind of fixed precision decimal type as basic, standard types, instead of the latter having to be a bolt-on.
<RX14> well modern CPUs are designed to handle integers and IEEE floats
<apotheon> RX14: IEEE 754 is also "up to the limits of RAM", basically, so you "don't want your floats to use all of your ram" just the same for that.
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<apotheon> Yeah, and I think it's a problem that CPUs bias availability of numeric types that way.
<RX14> but i would hardly call crystal's big types bolt on
ocast has joined #crystal-lang
<RX14> they're in the stdlib
<apotheon> Regardless of that, there's nothing that says programming language designers should make it stupidly difficult (relatively speaking) to write financial software without running the risk of getting your ass sued off.
<RX14> if we didn't use GMP they might even be required by default
<RX14> come on it's one require then they act like any other number type
<RX14> it's not difficult at all
<apotheon> RX14: I wasn't complaining about Crystal, so that doesn't bother me so much. It's better than what most languages provide, if they're precise decimal types.
<apotheon> Note I used Ruby as a bad example above, with BigDecimal, not Crystal. I just asked about what Crystal provides.
<RX14> i don't see why ruby would be bad either, all the operators in ruby are methods too
<RX14> so they can have bigdecimal etc be exactly the same
<apotheon> BigDecimal has rounding errors. There is no precision decimal in the standard library, last I checked.
<apotheon> You'd have to implement your own or get a gem, and all the available gems are less than ideal.
<Yxhvd> Regardless of what you do you will get rounding errors in some places.
<RX14> you could use a fraction datatype
<apotheon> I quite like rational number datatypes.
<Yxhvd> that may help a bit, but would not solve the problem (as some numbers simply cannot be represented as a fraction).
<RX14> yeah
<apotheon> Yxhvd: Any number that can be represented as a (terminating) decimal can be represented as a rational number (fraction).
<RX14> that was the point
<RX14> there's a lot of non-terminating decimals
<apotheon> Sure. Pi, for instance.
<RX14> some of which are rational some aren't
pawnbox has quit [Ping timeout: 258 seconds]
<apotheon> Anything that can't be represented as a rational number can't be *practically* represented as a decimal.
<apotheon> . . . because eventually you run out of time and RAM.
<jhass> Ruby has a rational type, even as literal these days
<jhass> 2/3r
<Yxhvd> nice
<FromGitter> <Sija> @jhass: might be nice to have 'em in Crystal too
<RX14> i would love to have the GMP datatypes implemented in crystal
<apotheon> Oh, yeah -- I should have asked whether Crystal has a rational type, too.
<BlaXpirit> Sija, wouldn't it be weird to have just a number literal call a LGPL-licensed library?
<RX14> no
<apotheon> yes
<apotheon> bleah, license contamination problems
ocast has quit [Ping timeout: 252 seconds]
<apotheon> I'm curious about why Crystal uses GMP instead of something like libtom.
<FromGitter> <Sija> @BlaXpirit: I was taking about the feature itself, not implementation details...
<RX14> apotheon, because gmp is much more available as a library and more mature
<BlaXpirit> would be nice, but i mean first step probably has to be a native crystal implementatio
<apotheon> BlaXpirit: Do you mean "implemented in Crystal"?
<BlaXpirit> yes
<apotheon> I might be inclined to start work on something like that for some GMP stuff, starting out by borrowing heavily from libtom (WTFPL, so totally kosher to do that), if the Crystal license was right.
<apotheon> err, s/for some GMP stuff/to replace some GMP stuff/
<BlaXpirit> apotheon, are you a lawyer?
<BlaXpirit> copyright lawyer, more specifically?
<apotheon> No, but I have paid a lot of attention to licensing, learned a lot about what all that crap in them means and how it works, and so on.
<apotheon> If I didn't have a distaste for bureaucracy and manipulation of "professional ethics" to do more generally unethical things, I'd probably have gone into law instead of programming.
<RX14> honestly i don't see a problem with the apache license
<apotheon> I know a patent lawyer who takes my advice for software licensing. It's kinda hilarious.
pawnbox has joined #crystal-lang
<BlaXpirit> WTFPL makes me cringe so hard (beerware license even more so). my opinion on it: nobody knows if it has any actual legal validity. i don't take projects that use them seriously. lack of a license means you can't do anything with the software. a joke in place of a license makes little difference.
<apotheon> BlaXpirit: Nobody knows if most of the GPL has any actual legal validity, either.
<BlaXpirit> it's been used in court, so yes, it does
<apotheon> BlaXpirit: . . . but there are precedents for very ad-hoc, non-legalese statements of intent having legal force in terms of copyright licensing.
<BlaXpirit> not sure what you mean by "most" but at least it gives you SOME rights
<RX14> apotheon, what's wrong with the apache licence on crystal
<apotheon> BlaXpirit: Most of the GPL was not actually addressed in court cases, so most of it is still somewhat in question.
<BlaXpirit> you're changing the topic
<Yxhvd> any reason to not use a already done license, like ICL or something like that.
<apotheon> BlaXpirit: Litigation addresses things as specifically and narrowly as possible, especially as it moves up the hierarchy of appeals, so very little actually gets set in precedent for the typical case.
<apotheon> BlaXpirit: In what way am I changing the topic?
<BlaXpirit> i say how WTFPL is possibly invalid and you say most of GPL may be mostly invalid, as if that makes things better
<apotheon> RX14: There are bureaucratic active requirements in ALv2 that are very easy to accidentally violate.
<BlaXpirit> there we go. there's words i can put my signature under
<apotheon> RX14: . . . such as including notices of changes to files and a hands-off policy for files named NOTICE.
<apotheon> BlaXpirit: That wasn't a change of topic. It was me pointing out that this doesn't seem like much of a concern particular to WTFPL.
<apotheon> BlaXpirit: . . . because it's not particular to WTFPL.
<RX14> apotheon, neither of those things are a real issue
<BlaXpirit> well that's just one thing so far, but it's very real
<RX14> people break laws all the time and you don't get arested
<apotheon> I agree that WTFPL is not the best-written license by a long shot, but it's also pretty straightforward, which counts for a lot in licensing.
<apotheon> RX14: I do not risk the rest of my professional life on hand-wavy stuff like that.
<apotheon> RX14: Not of I don't have to, anyway.
<RX14> well i would argue that you risk going to prison just as much every day
<apotheon> s/Not of/Not if/
<apotheon> Yeah -- but to some extent I *have to*, in part because so many laws are contradictory and make a criminal out of someone no matter what that person does.
<apotheon> There's a difference between that and "I'll choose this thing, with far less legal risk, over that thing, with far greater legal risk."
<RX14> yes you know the police won't arrest you for it
<RX14> same with software licenses to me
<RX14> if you intend to do something bad you'll be liable
<apotheon> No, I won't get arrested for forgetting a change notice in an ALv2 project (under current law), but I could get sued out of my livelihood, possessions, and savings.
<RX14> but if you acidentally break a minor clause then you'll get at most a strongly worded letter asking you to comply
<RX14> apotheon, that wasn't what i said at all
<RX14> and it's also wrong
<apotheon> One of the biggest problems with bad licensing is that you don't have to go to court to get ruined by a lawsuit. You could end up losing everything in the process leading up to the court case, if you aren't independently wealthy.
<apotheon> Winning a case can ruin you, too. Members of Led Zeppelin recently won a copyright case and ended up paying millions of dollars for the privilege of winning.
<RX14> well if you can convince everybody who ever contributed to crystal to approve the MIT license then go ahead and submit a PR
<RX14> until then it's pointless whining about technicalaties that will never happen
<apotheon> RX14: I wasn't whining. I said I might be inclined to do something if not for the license. There's a difference. You, however, decided to turn it into an opportunity to give me shit over my license preferences.
<apotheon> I suspected that might happen, so I tried ignoring the first passive-aggressive comment or two from you about it, but when you asked me a question directly I answered it, and this is what it got me.
<RX14> i agree with your licence preferences actually
<RX14> i just don't think it's as much of a deal as you amke it out to be
<apotheon> You're welcome to that opinion.
<RX14> i prefer MIT to apache2 yet i'm not going to refuse to use crystal because of it
<apotheon> Please don't turn a simple comment into a big discussion that ends with you giving me shit about my license preferences, though.
<apotheon> I don't "refuse" to use Crystal. I just drop it down the list of priorities quite a lot, to the point where some outside inducement has to come into play.
<apotheon> Otherwise, I'll most likely just pick up Haskell or Rust (for instance) instead.
<RX14> well, if you can contact everyone who has contributed to crystal and convince them to relicense MIT, i'll be happy for you but i don't think you will
<apotheon> Crystal still interests me, in concept, so I haven't quite weaned myself off this IRC channel yet, but if I can't talk about it here without something like this happening semi-regularly I should just drop the channel now.
<BlaXpirit> apotheon, the issue i have with this is that many discussions with you just end up with talking about licenses, that gets old quickly. if you want to take care of this, first of all you open an issue.
apotheon has left #crystal-lang [#crystal-lang]
<RX14> ^
<FromGitter> <Sija> @apotheon: Creating an issue on GH seems indeed like a good starting point for discussion
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<jeromegn> I wonder if there are any gotchas in transforming this ruby code to crystal: https://github.com/protobuf-ruby/beefcake/blob/master/lib/beefcake/buffer/decode.rb#L43-L57
<RX14> jeromegn, is a protobuf uint64 not just able to be read?
<jeromegn> how do you mean?
<RX14> how is a protobuf uint64 encoded to require such complex code?
<jeromegn> I wish the protobuf format was simpler :( https://developers.google.com/protocol-buffers/docs/encoding#structure
<jeromegn> yea, it’s encoded in an unconventional manner as far as I understand
<RX14> jeromegn, i would look at the C code for decoding ints
<jeromegn> yea, that’s probably a good idea
<RX14> because ruby's code has to deal with... ruby
pawnbox has quit [Remote host closed the connection]
<RX14> the docs say encoding is "(n << 1) ^ (n >> 31)"
<RX14> protobuf encoding seems an absolute pain in the ass to me
<RX14> i wish i had time for a capnproto implementation in crystal
<RX14> it seems like a much better spec and much better protocol
<RX14> and it has a RPC standard which is always nice
justinmcp has quit [Quit: No Ping reply in 180 seconds.]
justinmcp has joined #crystal-lang
Netfeed has quit [Changing host]
Netfeed has joined #crystal-lang
Netfeed has left #crystal-lang ["WeeChat 1.0.1"]
<FromGitter> <alex-lairan> I've a problem with macro ^.^
<FromGitter> <alex-lairan> I want to call a specific controller, so my macro look like this:
<FromGitter> <alex-lairan> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=57b0cbd8625cb3d845467f80]
<FromGitter> <alex-lairan> But, with variables this doesn't work
<FromGitter> <alex-lairan> There is a possibility to do this work with variables?
<jhass> well think about it, the macro is run at compile time, the variable's value is only known at run time
<FromGitter> <alex-lairan> Oh crap, I have a file with Klass and method to call, how I can do what I want? ^^
<FromGitter> <alex-lairan> Example, on my file, I have ⏎ ``` ⏎ klass: User
<jhass> write a macro that generates a case when dispatcher
<FromGitter> <alex-lairan> what kind of case?
<FromGitter> <alex-lairan> methods?
<jhass> instance = Klass.new; {% begin %}; case method; {% for method in Klass.methods %}; when {{method.name.stringify}}; instance.{{method.name.id}}; {% end %}; end; {% end %}
<jhass> or within Klass, {% for method in @type.methods %}
<FromGitter> <alex-lairan> Oh, when I read the file :)
<FromGitter> <alex-lairan> I try to create a router for my REST API framework ^^
<FromGitter> <alex-lairan> This could create a lot of cases not?
<jhass> sure
<FromGitter> <alex-lairan> no, I go watch it :)
<jhass> or artanis for another similar approach
<crystal-gh> [crystal] bcardiff pushed 1 new commit to master: https://git.io/v6zP4
<crystal-gh> crystal/master aa7a7ea Brian J. Cardiff: Playground: ensure compiler exception are shown...
<FromGitter> <alex-lairan> What this done? https://github.com/jreinert/crouter/blob/master/src/crouter/router.cr#L29 I don't understand ^^'
<jhass> it's a HTTP::Handler, it calls the next middleware in the chain
<jhass> (if any)
<FromGitter> <alex-lairan> Oh yes, I've not see this inherite from HTTP::Handler :)
<FromGitter> <alex-lairan> thank :)
<FromGitter> <drosehn> Mildly odd: Ruby as the class Regexp, Crystal has Regex. I must admit that even after all my programming in ruby, I still often type Regex and then have to correct it.
<FromGitter> <drosehn> Also, it seems that Regex.new() in crystal requires a string, while ruby allows the first parameter to be another regex. I'm not sure that crystal intends to reject regex's as the first parameter, but it gets an error trying to do a gsub() on the regex if you do try it.
<FromGitter> <drosehn> er, I meant to say "Ruby HAS the class Regexp..."
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 276 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Goba has joined #crystal-lang
Goba is now known as hooo
<hooo> whats the point of this language?
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v6zyy
<crystal-gh> crystal/master 356cf4d Patrik Wenger: String#tr: don't crash if replacement is empty (#3129)
<RX14> hooo, there's langauge goals on https://crystal-lang.org/
bjz has joined #crystal-lang
bjz has quit [Ping timeout: 258 seconds]
<travis-ci> crystal-lang/crystal#356cf4d (master - String#tr: don't crash if replacement is empty (#3129)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/152271301
<hooo> RX14, why make this if so many other languages exactly like it already exist? Nim, Julia, ...
<RX14> hooo, neither of those are like crystal
<RX14> nim has pythonish syntax
<hooo> yeah just like Crystal
<RX14> no
<RX14> crystal has ruby syntax
<hooo> lol
<hooo> they are pretty much the same
<RX14> oh yes apart from the differences in use of whitespace, do/end instead of :, method naming, conventions, postfix if, the whole of the stdlib yes they're clearly the same
<RX14> no, no they are not the same at all
<RX14> the only thing the same about them is that they're not C
<RX14> or C-based
<hooo> the syntax is kinda the same, i imagine the standard library of Crystal wont be the same as Ruby either so that cant be an argument
<RX14> they have similar APIs
<RX14> most of the common classes are very similar
<RX14> array, enumerable etc.
<RX14> and no the syntax is not the same at all
<RX14> starting with the fact that python uses indenting for blocks and ruby uses do/end
<RX14> it's completely different
bjz has joined #crystal-lang
Philpax has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]