<alex``>
The entry-point of `time` to generate a time from a string is `parse(time_str, printf_pattern)`.
<alex``>
It calls `time/format.cr`, which initializes with `printf_pattern` and call parse with `time_str`.
<alex``>
The entry-point of `time.cr` to generate a string from a time is `to_s(printf_format)`.
<alex``>
It calls `time/format.cr`, which initializes with `printf_pattern` and call the formatter with the time.
<alex``>
The two classes (formatter and parser) encapsulate certain data for their stuff and use a common interface `visit` in `time/format/pattern.cr`, which is the actual parser.
<alex``>
`visit` advance char by char in the pattern, when it encounters a recognized format, it calls methods by certain name, which are implemented by `formatter.cr` and `parser.cr`.
<alex``>
for `parser` it means consumming the string it received when initializing, and set for example `@day` with the given string portion.
<alex``>
for `formatter` it means pushing to the `io` it received when initializing, and print the correct date format with `time` is has when initializing.
<alex``>
`format` is typically called with just the `time` format, but under the hood it build a string with a block and pass both `time` and the `str` io to the formatter.
masterdonx2 has quit [Ping timeout: 268 seconds]
MasterdonX has joined #crystal-lang
<FromGitter>
<mavu> Current Mood: Writing c++. I wish I could use crystal to do embedded development. :(
<FromGitter>
<confact> @mavu what is missing to use crystal for embedded?
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter>
<mavu> Crystal is too big to be used on the sort of chips I use. I don't think the crystal compiler can or will ever target Atmel microcontrolers. or even something like an ESP32. (although the later might theoretically have enough memory i think)
<FromGitter>
<straight-shoota> @mavu The compiler itself could relatively easily target embedded chips, as long as there's an llvm backend available. The limiting factor is however the standard library. There have been attempts to build alternative stdlibs with much smaller footprint.
<FromGitter>
<straight-shoota> So that could technically be an option for embedded systems.
<FromGitter>
<straight-shoota> alex, your assessment of the time formatter architecture is correct
<FromGitter>
<mavu> @straight-shoota Bigger chips are becoming more cheap, so in a couple of years this will probaboy be a non issue anyway. (i hope)
<FromGitter>
<j8r> there will always be small limited chips
<FromGitter>
<faustinoaq> @elorest Hi again, sorry I couldn't reply, I'm working at DELL EMC now, I'm kinda free from 7:00 P.M to 10:00 P.M. EST.BTW, I'm working on a DELL internal API using Amber πͺ
<FromGitter>
<j8r> economizing even $0.01 on billion chips results to 10 millions dollars saved
<FromGitter>
<faustinoaq> @mavu I remember someone tried to port crystal to smt32, those chips are very powerful and pretty cheap, and I think it is possible. Also, I have an unfinished experiment about crystal on AVR chips like arduino and attiny, I'll try to finish it and share it with the crystal community π
<livcd>
Is there anything (even just theoretical) way to solve the slow compile times at least for development process ?
<FromGitter>
<j8r> livcd: shared libraries, in C. In Crystal it is very experimental
<livcd>
dont really get it
<FromGitter>
<j8r> for example, instead of using a Crystal shard, using a C library
<FromGitter>
<j8r> or write you libraries in C
<FromGitter>
<j8r> but this strips the point of Crystal then
<livcd>
yeah
<FromGitter>
<j8r> there are POC gists/issues about shared libraries in Crystal
<FromGitter>
<j8r> there is also making the compiler multi-threaded
<FromGitter>
<faustinoaq> @grkek Nim can do that, Crystal not yet, I think there is an open issue on github about Javascript and Crystal.
<FromGitter>
<grkek> thank you
duane has quit [Ping timeout: 265 seconds]
<FromGitter>
<faustinoaq> @grkek Also you can try Mint https://www.mint-lang.com/, this front-end language is built on crystal, so you can do interesting things with it, similar to react and vue.
<FromGitter>
<j8r> anyone has experience with Mint? What's its pros/cons vs Svelte or Vue?
<FromGitter>
<grkek> I've seen that
<FromGitter>
<grkek> that is one of the most interesting things
<FromGitter>
<grkek> ive came across so far
<FromGitter>
<grkek> I really like the JSX approach to rendering
<FromGitter>
<Blacksmoke16> ah ok, yea probably fine
<alex``>
initially I was doing `text = case object` and print the return text after the block, but since I added the "Should sleep?" I cannot organize my code that way
<FromGitter>
<636f7374> I like it, this is the advantage of Crystal / Ruby. (Compared to Rust).
<FromGitter>
<636f7374> π
<FromGitter>
<tenebrousedge> it's nice that it's an option. It helps with code golf sometimes
<FromGitter>
<636f7374> π
<FromGitter>
<Daniel-Worrall> I use parentheses when there's ambiguity, if the parameters call methods or if it calls another method (can fall under ambiguity)
<FromGitter>
<tenebrousedge> I wrote a Lisp in Crystal so that I can use parentheses with my parentheses in my parentheses o_____o
<FromGitter>
<636f7374> Lisp is good, Clojure is betterγ :)
erdnaxeli has quit [*.net *.split]
alexherbo28 has joined #crystal-lang
alex`` has quit [Ping timeout: 265 seconds]
alexherbo2 has quit [Ping timeout: 265 seconds]
alexherbo28 is now known as alexherbo2
<FromGitter>
<watzon> Well clojure is a lisp, so...
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Remote host closed the connection]
alex`` has joined #crystal-lang
ur5us has joined #crystal-lang
erdnaxeli has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
erdnaxeli has quit [*.net *.split]
duane has joined #crystal-lang
erdnaxeli has joined #crystal-lang
<FromGitter>
<wontruefree> We are hosting Vitalii Elenhaupt a Fullstack Software Developer and Crystal enthusiast. A high level architecture of the Ameba linter, the role of built-in Crystalβs Lexer and AST parser and future plans/challenges to make Ameba better. chicagocrystal.org/events/dfpqmrybcdbjb/
_ht has quit [Remote host closed the connection]
<FromGitter>
<rurounijones_gitlab> @lbarasti Thanks: I have zero experience with LLVM so, while I am sure there are tools out there, I have no idea what they would be nor how to use em, any recommendations would be appreciated!