laaron- has quit [Remote host closed the connection]
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
laaron- has quit [Remote host closed the connection]
moei has joined #crystal-lang
<FromGitter>
<proyb6> Saw it on Show HN!
<FromGitter>
<proyb6> Now, I think why not some folks post your Crystal shards on ```Show HN``` in full force? โ https://news.ycombinator.com/show
laaron has quit [Remote host closed the connection]
<FromGitter>
<vladfaust> @Blacksmoke16 come on, have some respect and write a Readme ๐
_whitelogger has joined #crystal-lang
<FromGitter>
<redcodefinal> Is there a way to have `JSON.mapping` allow an inheriting class to add to it's `JSON.mapping`? I'm struggling to describe the problem, here is the code. โ https://carc.in/#/r/5vn5 โ I'd like to get this to work where `B.new.to_json` will spit out variables `A#a` anf `B#b` but unfortunately I need to repeat the entire `JSON.mapping` of the inherited class. โ https://carc.in/#/r/5vn6
<FromGitter>
<vladfaust> @redcodefinal nope. `JSON.mapping` explicitly defines an initializer with variables passed to it. You either declare `a` nilable or with default value in `A`; or use `JSON::Serializable`
ashirase has quit [Ping timeout: 245 seconds]
laaron has joined #crystal-lang
ashirase has joined #crystal-lang
DTZUZO has joined #crystal-lang
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter>
<redcodefinal> @vladfaust ty for the suggestion worked like a charm.
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Remote host closed the connection]
<FromGitter>
<sam0x17> for the life of me I can't figure this out. I'm using a `Flate::Reader` to decompress some bytes that were compressed with a `Flate::Writer`, and basically everything works fine with the compressing, but the second I call any method that does any reading on the reader (`read_byte`, `read`, `gets_to_end`, etc), I get the following error complaining about `Flate::Writer`. The weirdest thing is nothing in the
<FromGitter>
... stack trace leads back to the lines that, if removed, cause the error to no longer be thrown. https://pastebin.com/NFvgSZg7
<FromGitter>
<sam0x17> (compile time error)
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
<mps>
so, i asked here just to be sure and to give him right answer. anyway any doc which explains rationale for omitting inc/dec
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron- has joined #crystal-lang
Raimondi has joined #crystal-lang
ua has quit [Remote host closed the connection]
ua has joined #crystal-lang
ua has quit [Remote host closed the connection]
ua has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
sandelius has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter>
<j8r> I guess because it's an unnecessary syntax
<FromGitter>
<j8r> strange that the compiler knows the syntax, but refuse to compile it by suggesting `+=` instead
<FromGitter>
<j8r> In this case I want to slam the compiler and tell it: "You know what I mean, why you don't want to compile it!" >:|
<mps>
'x += 1' is addition operation, i.e. while x++ just increment register so I presume it would be faster than 'x += 1'. assembler programmer speaks from me now ;)
<mps>
s/i.e.//
Renich has quit [Ping timeout: 245 seconds]
sandelius has left #crystal-lang ["Textual IRC Client: www.textualapp.com"]
<FromGitter>
<j8r> maybe it would worth it to have it then...
<mps>
but, if compiler 'know' that '+= 1' is a just increment value (var) by one, maybe it optimizes that at the compiled code
<mps>
didn't looked at resulting asm code
<mps>
but, every language have inc/dec operators so I think it will not hurt if crystal also have them
<FromGitter>
<proyb6> ++x and x++ can be confuse, Swift Evolution has this discussion that they won't implement ++ too
<FromGitter>
<proyb6> Ruby didn't too
<FromGitter>
<proyb6> Good night
<mps>
proyb6: go-lang also, but kept postfix versions
<mps>
inc/dec operators causes a lot of confusion for novice programmers, i know, especially prefix/postfix distinction
<mps>
imo, it is good to have them just for 'marketing' purposes, so critics of crystal then can't tell 'crystal even doesn't have inc/dec operators'
<FromGitter>
<j8r> that a really sub minor topic mps :)
<FromGitter>
<j8r> not having inc/dec isn't a big deal
<FromGitter>
<j8r> if some is bashing a language because of this, (s)he is mistaken seriously
<mps>
agree, but you know FUD (Fear, Uncertainty, Doubt) marketing could be effective, targeting uninitiated
<oprypin>
mps, much more effective FUD is "operator abuse"
<oprypin>
what rationale do you need, it's just a really stupid operator that just happens to have a useful niche specifically in C
<mps>
for me that is not problem and didn't thought about, till yesterday when i showed crystal to my son and explained some syntax and he asked 'no ++' with 'surprising face'
<FromGitter>
<j8r> what sad is we cant `def ++; end`
<FromGitter>
<j8r> we have to `def increment; end`
<oprypin>
in Nim you can. see how that turned out for them
<FromGitter>
<j8r> how that turned out?
<oprypin>
well it's a mess of random sigils
<mps>
I explained to him that the inc/dec isn't important and he agreed, but after that i thought how will other newcomer react to that especially if they don't have someone to explain 'issue' to them
<FromGitter>
<j8r> there is no problem to have a big doc explaining the language design
<mps>
j8r: that sounds as good idea
<FromGitter>
<j8r> for now there is the FAQ
<FromGitter>
<j8r> adding a section for inc/dec ops
<mps>
FAQ is also fine document
<FromGitter>
<Blacksmoke16> https://github.com/Blacksmoke16/CrSerializer should be pretty stable now. I'm out of ideas on what else to add for now; feel free to create some issues ;)
<FromGitter>
<straight-shoota> It would be wise if such an FAQ question was based on the actual reasons in the decision making for the language, not some guesswork put together in chat.
<FromGitter>
<j8r> that's a starting point @straight-shoota
<FromGitter>
<j8r> that's better than nothing at all
<FromGitter>
<straight-shoota> No, not really
<FromGitter>
<straight-shoota> It doesn't hurt at all to have no mention about why such a minor detail is not present in the language
<FromGitter>
<j8r> doens't hurt to have one too
<FromGitter>
<drujensen> @Blacksmoke16 ๐ฏ
<FromGitter>
<straight-shoota> Of course it does. The answer is simply based on your guesswork.
<FromGitter>
<straight-shoota> Please leave answering such questions to people who actually know an answer and don't assume.
<FromGitter>
<j8r> that's what the compiler say
<FromGitter>
<j8r> not me
<FromGitter>
<j8r> `Syntax error in eval:2: postfix increment is not supported, use `exp += 1``
<FromGitter>
<straight-shoota> The compiler message says the operator is not supported. It doesn't say ANYTHING about *why*.
<FromGitter>
<j8r> me too, don't say why in essence. If the compiler say I need to use +=1, this mean ++ isn't neceessary
<FromGitter>
<j8r> or useful in crystal
<FromGitter>
<j8r> else it won't suggest me to use +=1 or -=1
<FromGitter>
<straight-shoota> That's a bold assumption.
<mps>
it doesn't hurt to have that simple FAQ answer till someone who know rationale explain in more details
<FromGitter>
<j8r> yeah I've been concise purposely. Not good in English, "necessary" isn't the right word perhaps
<FromGitter>
<j8r> we can just keep what the compiler says: `use +=1 instead`
<mps>
i learned it when compiler told me
<FromGitter>
<straight-shoota> It's not about the content. The point is, you can't answer a question you don't know really know the answer to.
<mps>
when I started to learn and play crystal I tried some of my knowledge from other langs without reading a lot about crystal
<mps>
it was my intention to see how fast could one (before all I personally) 'jump' to crystal
<FromGitter>
<straight-shoota> @j8r If you want to have an FAQ entry about increment/decrement operators, please open an issue and let somebody with knowledge provide it.
<FromGitter>
<straight-shoota> Actually, it's probably better to make it a forum topic.
<FromGitter>
<straight-shoota> It's not really an issue for the bug tracker.
<FromGitter>
<j8r> I think the best would be a repo to host the language specifications
<FromGitter>
<j8r> where all/most design decision would be. Actually searching issue comments where a decision was made isn't really practical :/
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter>
<bew> @j8r ๐ for a repo/forum category to group all language-related
<FromGitter>
<j8r> when looking at https://github.com/rust-lang , Rust has done a great job about their organization - thats impressive :o
<FromGitter>
<j8r> just noticed they have separated they formatter to is own repo
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
<scott_tams>
with most languages, there are "keywords" and "special cases" which differ from the default syntax. This isn't the case in Crystal. *Everything* is a statically-typed object, or a method which acts upon one. Every single language construct comes from those two concepts (except macros but one could argue that's a second language like Go's Template language). So it doesn't seem that confusing to me to have a `++`
<scott_tams>
method which increments something on the object that it's acting upon. It isn't special syntax any more than `+=` is or even basic operators like `+` and `-`, it's just another method. There is a specific list of operators which are methods that compile with syntax sugar, and I don't see the harm in adding a pair more to the list.
<scott_tams>
OTOH, crystal seems to be more "one way to do things" than allowing you to work using what you prefer, so it fits with that mindset that it would be excluded.
<FromGitter>
<sam0x17> what's weird is I don't even need to create an instance of `InflateStream` for the compile error to occur -- if `InflateStream` has a `@reader.read` call somewhere in it, the error appears and complains about `DeflateStream`'s initializer. If `InflateStream` does not have a `@reader.read` call then `DeflateStream` works fine and no compiler error occurs
<scott_tams>
where is this "Flate" coming from?
<scott_tams>
I don't see a shard by that name
<FromGitter>
<bew> @j8r `rust-lang/rfcs` 's readme is pretty good, would be nice to have sth like that (smaller at the beginning) for crystal @bcardiff :)
<oprypin>
sam0x17, i suspect that reopening Slice caused this.
<FromGitter>
<bew> @sam0x17 what's the full error with trace (with `--error-trace`)
<oprypin>
no it's this one, lol
<oprypin>
def read(slice : Bytes)
<oprypin>
write(slice)
<oprypin>
end
<scott_tams>
ooof
<oprypin>
(not even the fact that it's calling `write`, who knows, maybe it's valid)
<oprypin>
`read` must always return an integer
<oprypin>
bew, error-trace is very helpful!
<oprypin>
sam0x17, props for providing a runnable example :>
<FromGitter>
<sam0x17> ahhh that makes sense, I was trying to hack it to do something before and left that
<FromGitter>
<sam0x17> thanks so much guys
laaron- has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter>
<Blacksmoke16> limitation is similar to radix tree, in that will kinda break if you have another route with placeholder in same location
<FromGitter>
<drujensen> @Blacksmoke16 very cool.
<FromGitter>
<Blacksmoke16> as i cant know if you mean to match that, or the other, possibly in future could figure it out based on regex requirements/param types, but that would require good amount of work i think
<FromGitter>
<drujensen> still think the annotations are an eye sore
<FromGitter>
<drujensen> so you are kinda AOPโing the class
<FromGitter>
<drujensen> Aspect Oriented
<FromGitter>
<Blacksmoke16> currently since you cant get a list of classes with a specific annotation, im just iterating over all the children of `Athena::Controller`
<FromGitter>
<Blacksmoke16> then pulling out methods with the `Get/Post/Put/etc` annotations
<FromGitter>
<dscottboggs_gitlab> regarding annotation syntax, do you think it would be up for debate or do you think that it's too late for that? If it's open for discussion, where would be the appropriate place? IMO there are a number of options that aren't quite as ugly that would be just as easy to compile with
<FromGitter>
<drujensen> lol, i thought we were in the amber channel
<FromGitter>
<Blacksmoke16> :P
<FromGitter>
<Blacksmoke16> maybe a forum thread?
<FromGitter>
<drujensen> didnโt mean to open a can of worms here. sorry.
<FromGitter>
<Blacksmoke16> but really its just personal preference, how it looks doesnt really bother me
<FromGitter>
<Blacksmoke16> i dont really care
<FromGitter>
<drujensen> I read code all day so its a big deal to me
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 240 seconds]
<FromGitter>
<drujensen> one reason I use ruby and crystal is the syntax is easy to read
<FromGitter>
<dscottboggs_gitlab> same
<FromGitter>
<dscottboggs_gitlab> I keep forgetting about the forum, though. That probably would be the place
<FromGitter>
<Blacksmoke16> :shrug: to each their own
<FromGitter>
<drujensen> yup, sounds like it
<FromGitter>
<Blacksmoke16> is all good
laaron has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
<FromGitter>
<7sedam7> hello people
<FromGitter>
<7sedam7> how do i connect to a mysql db over ssh in crystal
<FromGitter>
<straight-shoota> @7sedam7 I'm not sure that's possible out of the box
<FromGitter>
<straight-shoota> I suppose it's not a common feature in many other DB connectors.
<FromGitter>
<straight-shoota> A workaround would be to terminate the ssl connection to a local socket and connect to that. That's what I've done once or twice (not with crystal-db though).