RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.26.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
<FromGitter> <Blacksmoke16> have to be in marco land to get that
<FromGitter> <m-o-e> ha, perfect! yes, i kind of expected that a macro would be needed, but my macro skills are still in their infancy. this is a next level snippet for me, thank you very much! :)
<FromGitter> <Blacksmoke16> anything specific you trying to do? might be something better than that exampel
<FromGitter> <m-o-e> well, i'm porting https://github.com/ua-parser/uap-ruby to crystal (user agent parser based on a public domain regex list). the json-format of the regex list is a little iffy and uses numbered top-level keys instead of arrays in some places, so i need to iterate over them. i guess i could forgo mapping and just traverse via JSON::Any, but i'm kinda fond of the code-clarity that the mappings bring. anyway, the
<FromGitter> ... macro def solves my problem here. i'll release the
<FromGitter> <m-o-e> shard soon and happily take any PRs with improvements :)
<FromGitter> <Blacksmoke16> sounds like a plan
<FromGitter> <Blacksmoke16> could prob write a macro to generate getter methods that you could get by string keys
<FromGitter> <m-o-e> yea, a variant of the example you gave will do the trick for what i need here
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5d40
<FromGitter> <Blacksmoke16> or i have a better idea
<FromGitter> <m-o-e> nice, gonna check that out also
<FromGitter> <Blacksmoke16> id look more into the JSON::Serializable
<FromGitter> <Blacksmoke16> you also can use custom converters
<FromGitter> <Blacksmoke16> which could parse odd json and return just pieces you want
<FromGitter> <m-o-e> the 2nd one is neat indeed. i wonder why crystal doesn't ship with a macro for this get()-method by default? it looks like something that i'll probably need in every crystal program i write.
<FromGitter> <Blacksmoke16> im sure there would be a better way depending on your exact needs
slimep has quit [Read error: Connection reset by peer]
<FromGitter> <Blacksmoke16> you also could define that method like
<FromGitter> <Blacksmoke16> ```class Object ⏎ def get ⏎ xxx ⏎ end ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5bd513541c100a4f29f55f6f]
<FromGitter> <Blacksmoke16> then would be available in every class you make @Blacksmoke16
<FromGitter> <Blacksmoke16> since `Class` inherits from `Object`
_whitelogger has joined #crystal-lang
<FromGitter> <fusillicode_twitter> hi guys sorry for the bothering but I'm trying to grasp the problem of this code but I'm not getting anywhere :( https://play.crystal-lang.org/#/r/5d5x
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5d6x
<FromGitter> <Blacksmoke16> you gave your splat a name so has to be named when calling gb
<FromGitter> <Blacksmoke16> @fusillicode_twitter
<FromGitter> <Blacksmoke16> er more so because double splat captures named args
<FromGitter> <Blacksmoke16> so have to provide a key to use when calling gb, it can be whatever tho
DTZUZO has quit [Quit: WeeChat 2.0]
<FromGitter> <m-o-e> hmm, is there an easy way to pass the contents of a hash as kw-args to a method? i tried foo(**hash), but that doesn't work, apparently wants a NamedTuple
<FromGitter> <m-o-e> (but my attempts to create one from the Hash didn't work out either)
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5d7n/edit ?
<FromGitter> <m-o-e> no, more like: https://play.crystal-lang.org/#/r/5d7r
<FromGitter> <Blacksmoke16> you cant splat a hash
<FromGitter> <Blacksmoke16> do you just want the values?
<FromGitter> <m-o-e> well, it contains the key/values as i want to pass them (this is a common ruby idiom)
<FromGitter> <Blacksmoke16> not a thing in crystal, can only splat namedTuples and tuples
<FromGitter> <m-o-e> hmm is there an easy way to cast hash to NamedTuple?
<FromGitter> <Blacksmoke16> dont think so, a named tuple is immutable and types are known at compile time
<FromGitter> <m-o-e> an adhoc-way i mean. because if it takes lots of boilerplate i guess i can just spell out the args
<FromGitter> <Blacksmoke16> well wait
<FromGitter> <Blacksmoke16> is your hash alwasy going to be the same of the same keys/types?
<FromGitter> <m-o-e> yes, the types match what the method expects
<FromGitter> <m-o-e> it's all String => String | nil atm
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5d7s
<FromGitter> <m-o-e> ha!
<FromGitter> <Blacksmoke16> will have to change the typings as needed, as in that example they are String, not allowing Nil
<FromGitter> <Blacksmoke16> where are these hashes coming from? wouldnt it be better to make them into objects?
<FromGitter> <m-o-e> well... i guess in this case the straightforward way is actually shorter... ;)
<FromGitter> <Blacksmoke16> probably
<FromGitter> <m-o-e> nah making the hash an object wouldn't help, i'm just building up a record there
<FromGitter> <m-o-e> ^ snippet from the actual code
<FromGitter> <m-o-e> i guess in this particular case i could just initialize a blank Device (Device.new) and populate it incrementally. but that won't for records with non-nillable fields
<FromGitter> <m-o-e> anyway, no big deal, i'll just spell it out for now
<FromGitter> <m-o-e> (the method params)
<FromGitter> <Blacksmoke16> where is the stuff coming from? json data or?
<FromGitter> <m-o-e> yes, it's using your fancy get() method to peek into JSON mapped objects
<FromGitter> <Blacksmoke16> in that case wouldnt it be *much* easier to just parse the json into objects using `JSON::Serializable`?
<FromGitter> <Blacksmoke16> like `MyObj.from_json(json_str)`
<FromGitter> <m-o-e> possibly, i had used YAML.mapping so far
<FromGitter> <m-o-e> (it's actually YAML not json, but same diff)
<FromGitter> <m-o-e> well, it's not gonna help in this part of the code anyway (mapping already does the initial parsing)
<FromGitter> <Blacksmoke16> that is the better method, as the YAML.mapping might be deprecated in the future
<FromGitter> <m-o-e> ah, that's good to know. all docs i found only talked about mapping, didn't know Serializable exists ;)
<FromGitter> <Blacksmoke16> uyp
<FromGitter> <m-o-e> anyway thanks for all your input! :) time to catch a nap. might be back with more newbie questions soon ;)
<FromGitter> <Blacksmoke16> o/
<FromGitter> <fusillicode_twitter> here I am, thanks a lot @Blacksmoke16 🙇‍♂️ ⏎ I'm still trying to internalize the method arguments rules regarding the splats 😅
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
notdaniel has joined #crystal-lang
notdaniel has quit [Quit: Leaving]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
baweaver has quit [Ping timeout: 244 seconds]
rohitpaulk has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
baweaver has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 264 seconds]
rohitpaulk has joined #crystal-lang
RX14 has quit [Quit: Fuck this shit, I'm out!]
tilpner has quit [Quit: :wq]
RX14 has joined #crystal-lang
tilpner has joined #crystal-lang
<FromGitter> <girng> Hai o/
rohitpaulk has quit [Ping timeout: 246 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
<FromGitter> <melonlub> So I am inhereting from a parent class and I want to invoke the initialize method inside that class. Is that possible?
<FromGitter> <melonlub> How do I refer to the method of the class?
return0e has quit [Read error: Connection reset by peer]
return0e_ has joined #crystal-lang
<FromGitter> <melonlub> Is there a way to add method to an instance of class?
rohitpaulk has joined #crystal-lang
<FromGitter> <hanneskaeufler> Hi y'all, does anyone know how I can kill a process that I started within a `spawn`?
<FromGitter> <hanneskaeufler> I am seeing dubious leftover processes named `crystal-run-eval.tmp`.
<FromGitter> <hanneskaeufler> Basically what I am doing is running `Process.run("crystal", ["eval, "some code"])` inside `spawn` so that I can kill it after a timeout period. Because "some code" can potentially contain endless loops.
<FromGitter> <dscottboggs_gitlab> isn't there an asynchronous version of `Process.run`? `.new` or `.exec` or something?
<FromGitter> <dscottboggs_gitlab> yeah, use `Process.new` instead
<FromGitter> <hanneskaeufler> This is my sandbox code: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bd5c6da82893a2f3b531a1d]
<FromGitter> <hanneskaeufler> however, `terminated?` returns false, which I don't know if it's a problem
<FromGitter> <hanneskaeufler> the bigger issue is that rogue thing I see in ActivityMonitor.app
<FromGitter> <dscottboggs_gitlab> try printing the PID and checking for it with `ps`?
<FromGitter> <hanneskaeufler> the PID that is output is gone I think
<FromGitter> <dscottboggs_gitlab> hm, I wonder what that process is then
<FromGitter> <hanneskaeufler> Me too :) But I can reproduce this 100% with my test script above, both on crystal 0.25.1 and 0.26.1
<FromGitter> <hanneskaeufler> happy to file a bug if it looks like one, but not sure yet if I'm doing anything wrong
<FromGitter> <dscottboggs_gitlab> oh!
<FromGitter> <dscottboggs_gitlab> oh
<FromGitter> <dscottboggs_gitlab> so I have a couple theories, but we'll probably need someone who knows more about crystal to make sure.
<FromGitter> <dscottboggs_gitlab> nope
<FromGitter> <dscottboggs_gitlab> no that doesn't make sense
<FromGitter> <dscottboggs_gitlab> idk
<FromGitter> <j8r> @dscottboggs_gitlab I've benmarked my new serialization format, if got: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Not that bad for a draft :) [https://gitter.im/crystal-lang/crystal?at=5bd5c82d1e23486b932fd0a4]
<FromGitter> <dscottboggs_gitlab> what are the results?
<FromGitter> <j8r> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bd5c87eef4afc4f28e60771]
<FromGitter> <hanneskaeufler> I *guess* it has to do with the `crystal eval` because when I run a bash endless loop I don't see that `crystal-run-eval.tmp`
<FromGitter> <dscottboggs_gitlab> maybe crystal eval forks into a new process that you can't kill because you don't know the PID
<FromGitter> <dscottboggs_gitlab> you should probably try to avoid doing `crystal eval` anyway, it's going to kill any sort of performance
pabs has joined #crystal-lang
<FromGitter> <j8r> @hanneskaeufler it's that, crystal run and eval compile and run a temporary file
<FromGitter> <j8r> better to compile directly to a binary
<FromGitter> <hanneskaeufler> Happy for any alternative solutions
<FromGitter> <j8r> ```code paste, see link``` ⏎ ⏎ i got ` CON::Any 334.81k ( 2.99µs) (±10.44%) 1969 B/op 1.76× slower` [https://gitter.im/crystal-lang/crystal?at=5bd5c9801e23486b932fd71d]
<FromGitter> <dscottboggs_gitlab> @hanneskaeufler why not just put the `loop { puts "hello" }` inside your code and compile it with the rest of your program?
<FromGitter> <hanneskaeufler> What I am doing is getting some source code, mutating the ast, and then running that source through crystal eval. It is part of my mutation testing framework.
<FromGitter> <dscottboggs_gitlab> oh
<FromGitter> <dscottboggs_gitlab> that sounds like a job for macros
<FromGitter> <dscottboggs_gitlab> @j8r so the CON uses somewhat less memory but takes somewhat longer to process as of this draft?
<FromGitter> <hanneskaeufler> Care to expand? I failed to get any other way to reasonably work, the crystal eval works quite nicely except now I'm trying to kill endlessly running processes because some mutations lead to broken loops etc.
<FromGitter> <dscottboggs_gitlab> I'm not exactly sure I understand the work you're trying to do but macros allow you to generate crystal code on the fly in your program, so maybe you could move the logic that you're trying to put into an eval into a macro instead. just an idea
<FromGitter> <j8r> @dscottboggs_gitlab I don't know for memory, here it's memory throughput
<FromGitter> <dscottboggs_gitlab> oh I see
<FromGitter> <j8r> but macros are at compile time, they produce text as source code
<FromGitter> <dscottboggs_gitlab> I'm sure you could make it faster than JSON, just by the nature of the syntax you've chosen
<FromGitter> <dscottboggs_gitlab> mm, so that wouldn't help him because he's trying to do it at runtime
<FromGitter> <j8r> Yeah, I think too. The only complexity added are key vs value
<FromGitter> <hanneskaeufler> https://github.com/hanneskaeufler/crytic for anyone interested. I didn't see a way to do it with macros, I might be overlooking something though.
<FromGitter> <hanneskaeufler> So could I run a `Process.new("crystal", ["build", "source", "-o", "program"])` and then `Process.new("./program")` or something like it?
<FromGitter> <hanneskaeufler> and the second one I might be able to kill, mhm ...
<FromGitter> <hanneskaeufler> Ah no I can't pipe code into `build`
<FromGitter> <hanneskaeufler> would have to dump into a tempfile first
<FromGitter> <dscottboggs_gitlab> yup
<FromGitter> <Blacksmoke16> @melonlub do you have an example of what you trying to do?
<FromGitter> <Blacksmoke16> maybe look into macros or modules
<FromGitter> <malkomalko> greetings and good morning everybody 👋
<FromGitter> <Blacksmoke16> o/
emilsp has joined #crystal-lang
<FromGitter> <alehander42> do crystal macros produce text? or AST?
<FromGitter> <hanneskaeufler> they produce text
<FromGitter> <hanneskaeufler> `Macros are methods that receive AST nodes at compile-time and produce code that is pasted into a program.` from https://crystal-lang.org/docs/syntax_and_semantics/macros.html
<FromGitter> <alehander42> yeah I read the book section
<FromGitter> <alehander42> wow they're much different than what I imagined
<FromGitter> <alehander42> interesting tho
<FromGitter> <alehander42> nice
<FromGitter> <hanneskaeufler> yes they are cool. I have mainly used them as a way to remove duplication so far
<FromGitter> <rishavs> i dislike macros. they feel too much like magic :/
<FromGitter> <Blacksmoke16> welp
<FromGitter> <Blacksmoke16> better than a bunch of boilerplate everywhere
<FromGitter> <malkomalko> yah, it's just a powerful preprocessor step... I'm in big favor of them, they aren't nearly as magical ruby metaprogramming and quite readable
<FromGitter> <rishavs> btw, is there a way to find out what kind of exception was raised? For example, i am raising an exception `<Noir::ValidationError:The password (2 chars) should be between 3 and 32 chars long.>` ⏎ I currently am checking the exception message which I really dont want to. I'd rather just check if it is a `Noir::ValidationError`
rohitpaulk has quit [Ping timeout: 246 seconds]
<FromGitter> <Blacksmoke16> use a begin/rescue
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bd5e70e435c2a518e1bcc99]
<FromGitter> <Blacksmoke16> @rishavs
<FromGitter> <rishavs> i was actually thinking of making a custom http handler for these exceptions. I am indeed using begin/rescue right now, but i have the same code being repeated everywhere in my project
<FromGitter> <Blacksmoke16> use a macro :P then its all in one place and just expands to what each case needs ;)
<FromGitter> <rishavs> T__T
<FromGitter> <Blacksmoke16> but that code there would make it so only your validation errors are in that block, ofc could then have other rescue blocks for other types, or as a catchall for the rest
<FromGitter> <rishavs> maybe i should just use a structured message string. something like `raise Exceptio.new("ValidationError: Wrong number of acharacters")
<FromGitter> <Blacksmoke16> have each validation have its own exception
<FromGitter> <Blacksmoke16> then you could specify catch `Noir::ValidationError::InvalidSize` or something
<FromGitter> <rishavs> nice. thats a good idea too
<FromGitter> <Blacksmoke16> can inherit from your main `ValidationError` and call `super` to set that specific exceptions message
<FromGitter> <rishavs> hmm... thanks for the idea
<FromGitter> <Blacksmoke16> np
<FromGitter> <Blacksmoke16> should also allow you to also rescue the parent class `ValidationError` and that would catch all validation errors, vs having to define a rescue for each case
<FromGitter> <scatterp3> are there any crystal coders here looking for work ?
ua has quit [Read error: Connection reset by peer]
<FromGitter> <eatmycake> Community Discussion: Should Crystal team release 0.2x (WIP) or 1.0 next? ⏎ ⏎ It has been years and the trend is going downhill in the Reddit group and Crystal community especially Japan. I might have no influence on the team's decisions, on the other hand, 2019 is approaching in the age of AI and space, what's happening could be a great timing for you to shout and show the world, "Come on developers! We
<FromGitter> ... want to show our 1.0 milestone cake to the world! Let work together with our brilliant work into your productions!", if you don't start that, no one will talk about it and they will always remember Crystal is *forever* WORK-IN-PROGRESS then the community would feel safer to go with Go and Kotlin/Swift. ⏎ ⏎ You definitely hav ... [https://gitter.im/crystal-lang/crystal?at=5bd5eeda435c2a518e1bfe83]
ua has joined #crystal-lang
<FromGitter> <dscottboggs_gitlab> I think a release should be based on the presence or lack thereof of particular bugs and features. I'm fairly sure it's been well established that there are a few projects that need completed before crystal should be considered stable. Namely: parallelism, and windows support. Also, this isn't as commonly talked about but I read that there are plans to revamp HTTP::Server in a way that would involve
<FromGitter> ... breaking changes.
<FromGitter> <dscottboggs_gitlab> If people go bragging about a 1.0 release then a year later put out a breaking 2.0 or there are bugs or concurrency doesn't *really* work, then that looks bad and people are less likely to adopt it in the future
<FromGitter> <j8r> @eatmycake you can't just tag a 1.0 milestone because it's cool. 1.0 will be here when ready and considered *stable*. Else, the project seriousness will go down.
<FromGitter> <j8r> everyone want the 1.0, core devs, community, all. But it's not ready.
<FromGitter> <j8r> You can help on docs, resolve issue and send PR @eatmycake if you want to accelerate the process 😄
<FromGitter> <dscottboggs_gitlab> ditto haha
<FromGitter> <dscottboggs_gitlab> I'm looking forward eagerly to what 0.27 will bring :)
<FromGitter> <j8r> @dscottboggs_gitlab hey i got ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bd5f381bbdc0b2505b412b9]
<FromGitter> <dscottboggs_gitlab> NICE!
<FromGitter> <j8r> @dscottboggs_gitlab The trick is: my lexer use only `IO::Memory.new`. But JSON use `Char::Reader` by default. @bew it's likely the performance aren't the same
<FromGitter> <j8r> So here I compare `IO` parsing. I need to add optimizations for `String` parsing
<FromGitter> <dscottboggs_gitlab> but isn't Char::Reader supposed to be optimized for reading chars, and hence faster in this case?
<FromGitter> <j8r> there is `IO#read_char`, and since @bew says `IO::Memory.new String` doen't impact performance... But that's OK for a draft, thanks to him I have avoided premature optims. Time to dig on `Char::Reader` :)
<FromGitter> <j8r> the classic way is to use a buffer where you append chars, and then build the string (https://github.com/crystal-lang/crystal/blob/master/src/json/lexer/io_based.cr) But there is https://github.com/crystal-lang/crystal/blob/master/src/json/lexer/string_based.cr#L14 for String
<FromGitter> <j8r> it remember the position, and take the String between pos1 and pos2. That's this trick that produces this perf difference
<FromGitter> <rishavs> My take on the 1.0 release is that it absolutely needs; ⏎ ⏎ 1) Windows support ⏎ 2) parallelism ⏎ 3) Inmix GC ... [https://gitter.im/crystal-lang/crystal?at=5bd5f5eaab17df2631052f67]
<FromGitter> <j8r> The first point is blocking, maybe the two. 3 and 4 aren't, but welcomed :)
<FromGitter> <scatterp3> i am new but..
<FromGitter> <scatterp3> windows 10 can run linux code just fine a tutorial copy pasted covers 1
<FromGitter> <rishavs> i use wsl exclusively, but developing on windows vs compiling on windows are two different things
<FromGitter> <rishavs> For example, If i were to make a game in Crystal, I cant distribute it as most of my customers will be on Windows
<FromGitter> <scatterp3> ah ok yes compiling code executable on windows is a pretty big deal... (not that it effects me)
<FromGitter> <j8r> the only blocking point is Windows support. Even I don't care about, that's strange to say "We release 1.0, stable API, but we only support UNIX ". Multihread isn't blocking IMHO, there are languages in 1.x that don't/badly support it
<FromGitter> <rishavs> for me 1 & 2 are absolutely necessary as I have been looking forward to using Crystal for gamedev
<FromGitter> <scatterp3> 2 i think is important enough to be like 1.1
<FromGitter> <rishavs> 4 might be a problem for corporate adoption where you can have million loc projects
<FromGitter> <rishavs> 3, i agree, is just sugar :D
<FromGitter> <scatterp3> for 4 i am here from a corp looking for someone to port our code and at 100x faster i think corporate adoption wont be such an issue
<FromGitter> <j8r> @rishavs maybe, but quicker 1.0 is released better it is. Multithread can come later, no? agree with @scatterp3 :)
<FromGitter> <scatterp3> 1 and 2 should for sure be highest priority
<FromGitter> <scatterp3> releases brings news brings more interest more coders..
<FromGitter> <j8r> there is work on multi thread, it seems that some people are interested on this topic
<FromGitter> <scatterp3> can you drop to native c code ?
<FromGitter> <j8r> what do you mean @scatterp3 ?
<FromGitter> <scatterp3> is it possible to do something like emit asm_ or emit_ c
<FromGitter> <scatterp3> int he same way as jruby allows java..
<FromGitter> <scatterp3> or c allows asm
<FromGitter> <rishavs> doubt it
<FromGitter> <j8r> Transcompile? Crystal has LLVM as a backend, it may have a way
<FromGitter> <scatterp3> hrm i just noticed something very odd..
<FromGitter> <rishavs> Crystal compiles to LLVM IR
<FromGitter> <rishavs> and there are not a lot of mature projects which compile from LLVMIR to c
<FromGitter> <scatterp3> on twitter on my way here i saw a release of FIX engine in crystal... how can you have FIX with out threads makes no sense..
<FromGitter> <rishavs> what is FIX Engine?
<FromGitter> <scatterp3> some financial stuff..
<FromGitter> <scatterp3> maybe they did something clever..
<FromGitter> <rishavs> honestly, parallelism is actually not a big deal. If your language doesnt supports it, you can still achieve it using process management
<FromGitter> <rishavs> which is what most web frameworks in Crystal are doing right now
<FromGitter> <rishavs> to use all cores
<FromGitter> <rishavs> Actually I can also, do a "microservices" architecture for a game engine to saturate all cores. One binary only renders the view, One runs the game logic, one runs the state update and so on.....
<FromGitter> <scatterp3> i think 1 & 2 are nice but not critical for 1.0 release
<FromGitter> <rishavs> 1, IMO is. Its the highest requested feature for the last few years now.
<FromGitter> <rishavs> Everything else, we can work around
<FromGitter> <scatterp3> its been years
<FromGitter> <scatterp3> ?
<FromGitter> <scatterp3> if its been years then i think it should be a high priority ...
<FromGitter> <scatterp3> can you compile a library to be used in windows ? like a dll ? ⏎ at least the calling could come from native ruby?
<FromGitter> <rishavs> You can follow the windows effort here; https://github.com/crystal-lang/crystal/issues/5430
rohitpaulk has joined #crystal-lang
<FromGitter> <m-o-e> anyone know why this 2-liner doesn't wanna compile?: https://play.crystal-lang.org/#/r/5dde
<FromGitter> <m-o-e> it seems the macro somehow doesn't see the class that i pulled in via "require"
<FromGitter> <Blacksmoke16> is that an actual thing in stdlib?
<FromGitter> <m-o-e> you mean the "record" macro?
<FromGitter> <Blacksmoke16> `Semantic::Version`
<FromGitter> <m-o-e> no, that's from a shard
<FromGitter> <m-o-e> but the macro otherwise sees my own classes just fine. could it be that "require"s happen after the macro processing stage?
<FromGitter> <Blacksmoke16> there's actually a thing in the STDlib with the same require statement
<FromGitter> <Blacksmoke16> might be conflicting
<FromGitter> <Blacksmoke16> could try making the type `::Semantic::Version`
<FromGitter> <Blacksmoke16> iirc that says use the one in current namespace
<FromGitter> <m-o-e> still undefined constant
<FromGitter> <m-o-e> also it does *not* complain about the Semantic::Version.new line
<FromGitter> <Blacksmoke16> what shard is this?
<FromGitter> <m-o-e> if there already is a good semver wrapper in stdlib i'll also happily check that out
<FromGitter> <m-o-e> just don't want to write my own
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5ddj
<FromGitter> <Blacksmoke16> guess its just not documented?
<FromGitter> <m-o-e> duh! interesting, gonna try to make that work then
<FromGitter> <m-o-e> will also file a ticket on ljuti's repo, he should probably be told about the conflict
<FromGitter> <Blacksmoke16> i imagine thats why
<FromGitter> <m-o-e> yup. just odd that apparently my normal code sees the version that was "require"'d. while the macro apparently sees the stdlib one
<FromGitter> <m-o-e> it might be good if the compiler could detect and warn about such conflicts (not sure how difficult that would be to implement tho)
<FromGitter> <Blacksmoke16> im more wondering why it isnt in the generated docs
<FromGitter> <Blacksmoke16> is like its getting skipped, are comment blocks on it too
<FromGitter> <Blacksmoke16> no `:nodoc:` either
<FromGitter> <m-o-e> no idea. sounds like i stepped on something interesting there ;)
<FromGitter> <Blacksmoke16> maybe make an issue for it?
<FromGitter> <m-o-e> i made one on ljuti's repo
<FromGitter> <Blacksmoke16> for why its not in the generated docs i mean
<FromGitter> <m-o-e> hope i didn't violate too many ticket guidelines there ;)
<FromGitter> <Blacksmoke16> works for me :p
<FromGitter> <rishavs> WHat does `context.response.reset` do? Couldnt find it in the docs
<FromGitter> <Blacksmoke16> is it a thing?
<FromGitter> <ljuti> @m-o-e Thanks for your suggestion. I’ll rename the shard :)
<FromGitter> <ljuti> Also, did not know that there was a `SemanticVersion`class in stdlib
<FromGitter> <m-o-e> @ljuti ha, nice! thanks :) and yes, i hadn't thought of searching the stdlib either. just went straight for crystalshards.xyz
rohitpaulk has quit [Ping timeout: 244 seconds]
<FromGitter> <rishavs> @Blacksmoke16 I got it from the official Http::ErrorHandler code at https://github.com/crystal-lang/crystal/blob/fed95f7f445d3227f252e841d7cb5e412023aafd/src/http/server/handlers/error_handler.cr#L18
<FromGitter> <Blacksmoke16> looks like something that is used internally
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 250 seconds]
return0e has joined #crystal-lang
Raimondii has joined #crystal-lang
return0e_ has quit [Ping timeout: 246 seconds]
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
<FromGitter> <vladfaust> Look, we've got a Job! https://twitter.com/crystaljobsorg/status/1056648247861800960
<FromGitter> <vladfaust> Employer confirmed to be real, btw
<FromGitter> <Blacksmoke16> noice, congrats bud
<FromGitter> <vladfaust> Congrats to the community!
<FromGitter> <m-o-e> i would like to apply to the Example Job there, is the position still available? :P
<FromGitter> <j8r> @dscottboggs_gitlab With `Char::Reader` I got: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ :D [https://gitter.im/crystal-lang/crystal?at=5bd621651c100a4f29fbb6b4]
<FromGitter> <vladfaust> @m-o-e send an email 😆
<FromGitter> <m-o-e> will do ;)
<FromGitter> <j8r> @vladfaust Greeaaattt!!
<FromGitter> <j8r> haha
<FromGitter> <vladfaust> It definitely is
<FromGitter> <j8r> @vladfaust since you're here. I'm asking to the designer, what do you think of this serialization syntax? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5bd622873844923661b25211]
<FromGitter> <j8r> I'm close to a release, I've reached performance nearly on par with JSON :)
<FromGitter> <vladfaust> Let me see
<FromGitter> <vladfaust> First of all, there is a new syntax to learn. If it's about Crystal, then `bool` is understood, but `nothing` and `str` fields seem odd
<FromGitter> <j8r> that's the keys
<FromGitter> <vladfaust> Aha
<FromGitter> <j8r> a bit like in yaml
<FromGitter> <vladfaust> I see
<FromGitter> <j8r> in fact all is key - value, key - value
<FromGitter> <vladfaust> Thats great then. I advise to add spaces between brackets on `_inline` values
<FromGitter> <vladfaust> And add commas in array - both inline and multiline
<FromGitter> <j8r> yes, that's the best. This is to show the minimization possibilities :)
<FromGitter> <vladfaust> Also hash inline seems odd with spaces. I'd do it with `:`
<FromGitter> <vladfaust> That's just me, maybe
<FromGitter> <vladfaust> But I don't like spaces in this case
<FromGitter> <vladfaust> It's not explicit, you know
<FromGitter> <j8r> I could replace the space delimiter by a two point
<FromGitter> <j8r> like `key "value"`, `key:"value"` when uglified
<FromGitter> <vladfaust> Your goal is minimum size?
<FromGitter> <Blacksmoke16> is there a goal for this? Like why would someone use this over JSON for example?
<FromGitter> <j8r> HCL doesn't use commas for Hash.
<FromGitter> <markrjr> Could someone briefly explain how the retry_wstr_buffer function works?
<FromGitter> <vladfaust> JSON isn't perfect, it's a known fact. Google for json5, @Blacksmoke16
<FromGitter> <j8r> To be as simple and ad readable as possible
<FromGitter> <vladfaust> Could you give us a link, @j8r. I overall like it
<FromGitter> <j8r> have you tried to modify JSON or YAML by hand? Not the best, YAML is better but still
<FromGitter> <vladfaust> But you must create a JS library for parsing that CON format
<FromGitter> <j8r> I'm not skilled emough in JS :/ ⏎ For now, I'm finishing the specification, and docs. Next, convert `JSON::Any` <=> `CON::Any`
<FromGitter> <j8r> or just `CON::Any` => JSON text
<FromGitter> <vladfaust> To make it adoptable you should consider creating a simple JS parser
<FromGitter> <j8r> I think json will be still the best for frontend
<FromGitter> <j8r> The main use here is between server, and configuration format
<FromGitter> <j8r> will see :)
<FromGitter> <j8r> when WebAssembly will be out, JSON won't have the native performance advantage anymore
<FromGitter> <vladfaust> Yes
<FromGitter> <j8r> thanks for the feedback! I'm evaluating `:` delimiter. I'm afraid it'll add complexity, I'm considering it.
<FromGitter> <j8r> do you think there is a need for other number types than `Float64` and `Int64`?
<FromGitter> <vladfaust> I think there is no need. It's better to decide how big is the number by its string length, if its possible with your arch
<FromGitter> <vladfaust> I'm glad I could help, I appreciate that my opinion matters to someone :)
<FromGitter> <j8r> @dscottboggs_gitlab little update ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ 🎉 [https://gitter.im/crystal-lang/crystal?at=5bd62e28271506518d86373f]
<FromGitter> <vladfaust> Nice
<FromGitter> <j8r> Next week I release it. I'm still figuring how to use `JSON::Builder`...
<FromGitter> <j8r> and `JSON::Any#to_json(json)`
moei has quit [Quit: Leaving...]
<FromGitter> <straight-shoota> @markrjr `retry_wstr_buffer`creates a slice (static array) on the stack and yields it to the block. There it's typically used as a buffer argument for a libc call. If the buffer was large enough to hold the value, the method should immediately return/break the block. Otherwise it should pass the required buffer size back to `retry_wstr_buffer` which will then allocate a slice and yield it to the block.
<FromGitter> ... This time it should definitely be large enough to hold the buffer.
<FromGitter> <dscottboggs_gitlab> 👍