<FromGitter>
<tenebrousedge> people have been after `ifdef` for a while, I think
<FromGitter>
<sam0x17> @tenebrousedge looks like you can parse stuff and execute the nodes directly
<FromGitter>
<sam0x17> which means I could glue on new nodes to make a repl in theory
<FromGitter>
<tenebrousedge> how does that dovetail with what you've been doing?
<FromGitter>
<sam0x17> I've just been trying to make a repl
<FromGitter>
<tenebrousedge> by serializing data structures, yes
<FromGitter>
<sam0x17> this could be a more direct route
<FromGitter>
<sam0x17> so far I've been going at it from two approaches, one the serialization approach, and two seeing if I can just save the heap / stack / program counter to a file and re-load them, mixing with new code *somehow*
<FromGitter>
<sam0x17> this gets me a lot closer to the second one
<FromGitter>
<sam0x17> potentially
<FromGitter>
<tenebrousedge> huh. I don't see how, myself, but I have limited insight here
<FromGitter>
<sam0x17> I didn't look for something like this because I didn't think it would exist
<FromGitter>
<tenebrousedge> oh
<FromGitter>
<sam0x17> you can basically call all the compiler internals directly
<FromGitter>
<tenebrousedge> yes. Crystal is self-hosted
<FromGitter>
<sam0x17> I just didnt realize it would be to the point where you can go "parse this string as crystal source code and give me the AST nodes"
<FromGitter>
<sam0x17> and then run that plz k thx bye
<FromGitter>
<sam0x17> thought it would be this whole complicated thing
<FromGitter>
<tenebrousedge> ah. No, it seems to be relatively painless.
<FromGitter>
<absolutejam_gitlab> > I just didnt realize it would be to the point where you can go "parse this string as crystal source code and give me the AST nodes" β β Does this mean we could get a more powerful macro system, or would that means actually changing the compiler?
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 240 seconds]
absolutejam2 has quit [Ping timeout: 240 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
return0e has joined #crystal-lang
alexherbo22 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 252 seconds]
return0e has quit [Ping timeout: 265 seconds]
alexherbo220 has joined #crystal-lang
alexherbo22 has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
absolutejam2 has joined #crystal-lang
DTZUZO has joined #crystal-lang
DTZUZO has quit [Remote host closed the connection]
absolutejam2 has quit [Ping timeout: 265 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 240 seconds]
DTZUZO has joined #crystal-lang
<FromGitter>
<Blacksmoke16> @absolutejam_gitlab it does yea, uses the first one that doesnt error
<FromGitter>
<absolutejam_gitlab> 1) the `Symbol`, I just added that to test
<FromGitter>
<absolutejam_gitlab> That makes more sense
<FromGitter>
<absolutejam_gitlab> In a pattern-matching scenario
<FromGitter>
<sam0x17> at that point do you even want a class? you could just have a module full of methods
<FromGitter>
<Blacksmoke16> or an enum
<FromGitter>
<Blacksmoke16> but no, symbols dont work like that
<FromGitter>
<absolutejam_gitlab> > at that point do you even want a class? you could just have a module full of methods β β Probably what I would do
<FromGitter>
<sam0x17> conversely though, it sounds like you're trying to do some kind of "Runnable", as in a lightweight class with a run method. In crystal you are better off just using a block or a proc for that
<FromGitter>
<absolutejam_gitlab> Just thinking of how I'd write a function header in Elixir. I realise they're completely different paradigms, but it's a useful way to work and symbols don't seem to be awfully useful in Crystal
<FromGitter>
<sam0x17> I use symbols a lot
<FromGitter>
<absolutejam_gitlab> wasn't there even talk of removing them?
<FromGitter>
<sam0x17> the tricky part is you can go symbol => string but not string => symbol (even though at compile time it should be possible)
<FromGitter>
<Blacksmoke16> there is
<FromGitter>
<absolutejam_gitlab> or did I misconstrue that?
<FromGitter>
<sam0x17> yeah but too many libs rely on them
<FromGitter>
<sam0x17> I'd cry
<FromGitter>
<ImAHopelessDev_gitlab> @sam0x17 > other than the grocery store and the fictitious company in loony toons β LOL
<FromGitter>
<sam0x17> its funny cuz I literally just shopped at acme 20 mins before that
<FromGitter>
<Blacksmoke16> only uses they have are namedTuple keys and enum auto casting
<FromGitter>
<absolutejam_gitlab> I guess I get a bit too tunnel vision on Elixir's pattern matching when there alternative tools in Crystal
<FromGitter>
<Blacksmoke16> the talk was making them be solely auto casting feature
<FromGitter>
<absolutejam_gitlab> but I'm very fond of that paradigm
<FromGitter>
<sam0x17> the problem with that is (as far as I know) there is no way of "re-opening" an enum
<FromGitter>
<Blacksmoke16> right, how is that a problem?
<FromGitter>
<tenebrousedge> if you need to add to it later, use a `Hash`
<FromGitter>
<absolutejam_gitlab> > yea so `One | Two | Three` would go in that order β β and thanks, didn't see this. Tried it earlier and it didn't seem to work how I'd expect but I'll revisit
<FromGitter>
<sam0x17> so if you write a shard that has something that uses symbols (or now just an enum), and a user of the shard wants to have more symbols in there that define custom functionality, you can't because you cant add things to the enum?
<FromGitter>
<sam0x17> unless you can monkey patch enums, in which case that's cool af
<FromGitter>
<absolutejam_gitlab> Why would you use Notepad/
<FromGitter>
<sam0x17> tbh on macos it's a pain in the ass not having a dumb text editor
<FromGitter>
<Blacksmoke16> well not all symbols would be enums
<FromGitter>
<absolutejam_gitlab> Even the default encoding is fucky
<FromGitter>
<sam0x17> TextEdit does not cut it
<FromGitter>
<absolutejam_gitlab> vim
<FromGitter>
<sam0x17> I just nano
<FromGitter>
<absolutejam_gitlab> π
<FromGitter>
<Blacksmoke16> most symbols could prob just be strings
<FromGitter>
<Blacksmoke16> essentially the same
<FromGitter>
<sam0x17> or use URL bar as a text buffer like a pro
<FromGitter>
<tenebrousedge> nano is good. Spacevim Is β€οΈ
<FromGitter>
<sam0x17> in fact, I want that, like a system tray icon that I click and it expands to a dumb text area that has no formatting or purpose other than being an intermediate buffer
<FromGitter>
<sam0x17> I bet it tries to do some kind of formatty crap but haven't tried
<FromGitter>
<meltheadorable> @sam0x17 to the extent i ever care about having a dumb editor, textedit is dumb enough as long as you switch its default mode to plain text from rich text
<FromGitter>
<sam0x17> I just hate that when I open it its like "where do you want to store this"
<FromGitter>
<sam0x17> while I'm panicking on the phone with someone like hold on hold on opening a text editor
<FromGitter>
<meltheadorable> i mostly use textmate for that purpose though
<FromGitter>
<sam0x17> I really miss gedit
<FromGitter>
<sam0x17> might download the mac version (if it works)
<FromGitter>
<absolutejam_gitlab> I always have a tmux session open and just use kakoune
<FromGitter>
<sam0x17> yeah I'm weird, I think all this tmux / i3 / etc stuff is cool af, but I'm not going to use it if it doesn't also support mouse stuff like resizing the panes via a mouse, right clicking, etc
<FromGitter>
<sam0x17> I'll have a literal anxiety attack if I can't do that
<FromGitter>
<meltheadorable> nobody should code in notepad though
<FromGitter>
<absolutejam_gitlab> they do
<FromGitter>
<absolutejam_gitlab> tmux does
<FromGitter>
<absolutejam_gitlab> and i3 does
<FromGitter>
<sam0x17> that's cool then, I wasn't able to get that part working xD
<FromGitter>
<absolutejam_gitlab> bspwm is my favourite wm
<FromGitter>
<sam0x17> oh and I still want all my usual GUI for the system
<FromGitter>
<absolutejam_gitlab> but I'm on macOS full time atm because of shitty graphics drivers on liux
<FromGitter>
<sam0x17> just i3 in a window basically
<FromGitter>
<absolutejam_gitlab> you can get scripts that emulate it for other WMs
<FromGitter>
<absolutejam_gitlab> like KDE has one that does tiling
<FromGitter>
<absolutejam_gitlab> so you get the best of both
<FromGitter>
<absolutejam_gitlab> Or use something like Spectacle on macOS
<FromGitter>
<absolutejam_gitlab> at least for pseudo-tiling
<FromGitter>
<absolutejam_gitlab> I tried chunkWM but it was a bit buggy with some apps
<FromGitter>
<absolutejam_gitlab> since it's basically fighting against aqua
<FromGitter>
<sam0x17> on that note, I also want browser tabs in my vscode
<FromGitter>
<sam0x17> I bet there is an addon tho
<FromGitter>
<meltheadorable> i only use vscode for C, i use atom for everything else
<FromGitter>
<tenebrousedge> I'm using VSCode for JS and Ruby, spacevim for Crystal
<FromGitter>
<absolutejam_gitlab> I use Goland for Go - although, I've been trying VSCode again for it and it's just as good β PHPStorm for PHP (because the code jumping & refactor features rock), but I've been doing small, quick bits in Kakoune as the language server is awesome β JS in kakoune because I do so little and don't really need many features, Crystal in Kakoune, β yaml in Kakoune, β html/pug/whatever alternative
<FromGitter>
<meltheadorable> i canβt get into terminal editors, theyβre just worse
<FromGitter>
<absolutejam_gitlab> Every once in a while I just use VSCode because it's awesome at everything though
<FromGitter>
<tenebrousedge> VSCode + vim keybindings
<FromGitter>
<absolutejam_gitlab> I used to use them but I find vim keybinds outside of VIM either super clunky or super buggy
<FromGitter>
<absolutejam_gitlab> I use the vim plugin for Chrome but basically only use hjkl and x
<FromGitter>
<tenebrousedge> ew
<FromGitter>
<absolutejam_gitlab> might try and train myself to rely on some of the extra features of kakoune & tmux
<FromGitter>
<absolutejam_gitlab> keep meaning to
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
absolutejam2 has quit [Ping timeout: 240 seconds]
dannyAAM has joined #crystal-lang
<FromGitter>
<repromancer_gitlab> @absolutejam_gitlab Thanks for bringing up Kakuone; I think I'd seen the name around, but never noticed it was an editor.
alexherbo2 has joined #crystal-lang
<FromGitter>
<repromancer_gitlab> I'm one of those people who can't use anything less than my vim setup anymore, so I'm waiting on OniVim2 for an actually usable VS Code alternative. Kakuone looks like a very compelling alternative to Vim itself, though (I don't consider emacs compelling).
dwdv has joined #crystal-lang
<FromGitter>
<christopherzimmerman> Is it possible use a comparison operator in a macro? So calling it would look something like `mask_helper(>, gt)`
absolutejam2 has joined #crystal-lang
<FromGitter>
<sam0x17> btw to all using vscode, highly recommend vscodium as a zero-telemetry fork
<FromGitter>
<asterite> @sam0x17 for the unions you can either use the full union name, or there's a `crystal_type_id` that will give you a unique id for each type (though that might change between compilations)
absolutejam2 has quit [Ping timeout: 250 seconds]
<FromGitter>
<asterite> I think you should look at how Ruby's Marhsal is done. As I said, I might tackle this much later myself, though now I don't have time plus it's not a priority. You also might need to take into account recursion (like a parent-child relationship). In that case you want the marhsaller to remember each object marshalled with a number, then if you find that object again you put a reference to it instead of
<FromGitter>
... marshalling it again. Then the unmarshaller needs to remember the objects unmarshalled in the same way. But there's no way to use `Reference` yet so you have to go the `Void*` route, which make things more low-level than what one would like. In summary, marhsalling is hard.
<FromGitter>
<naqvis> *voilΓ * so nice to see Crystal making itself into TIOBE Index (https://www.tiobe.com/tiobe-index/) Top 50 languages π
<FromGitter>
<sam0x17> @asterite my problem has been how to instantiate a type based on its type id --- all my attempts casting an Int32 to a Class using things like unsafe_as fail because of restrictions on pointerof(*T) and that sort of thing
alexherbo2 has quit [Ping timeout: 240 seconds]
<FromGitter>
<sam0x17> I might have to do it with the string names of the types
<FromGitter>
<sam0x17> and in fact, that is probably a better approach because while it uses more memory, I bet the crystal_type_ids are specific to a particular compilation
alexherbo2 has joined #crystal-lang
<FromGitter>
<sam0x17> the recursive approach that you describe is basically what I do -- if something is a reference, I recursively visit it, if it has instance variables, I recursively store each of those, and if it is just a raw Value, I store its raw bytes
<FromGitter>
<sam0x17> unions will fully work for me if I can just encode what the actual type was on that instantiation of the union
<FromGitter>
<kinxer> @Blacksmoke16 :P I now know what to expect when you give me a YouTube link. I'll take a look at that later, but I've saved it.
<FromGitter>
<Blacksmoke16> π is from their new album coming up
<FromGitter>
<tenebrousedge> currently, I want to know more about generics, specifically how the type inference works. Probably MT would be good to talk about, too
<FromGitter>
<asterite> Sam Johnson: with recursion I mean, if a type Parent has a field Child, and Child has a field Parent, you have to find a way to stop the recursion when serializing either of them
<FromGitter>
<wontruefree> @tenebrousedge I will add those to my list and see if we can find someone who would be willing to give a talk on it
<FromGitter>
<sam0x17> @asterite ah, DAGs, hadn't thought of that yet. Yes that's another problem
<FromGitter>
<sam0x17> might have to cache things by address
<FromGitter>
<sam0x17> I'm of a mind now that it might be simpler to simply dump the current heap and deal with all references that way
<FromGitter>
<sam0x17> (if building a repl)
<FromGitter>
<sam0x17> so addresses from the previous compilation will still be valid since the heap space will be identical
<FromGitter>
<ilanpillemer> can you use StringScanner directly on STDIN?
<FromGitter>
<tenebrousedge> no, you need some sort of `get`
<FromGitter>
<tenebrousedge> StringScanner doesn't work on files
Nekka has quit [Ping timeout: 245 seconds]
<FromGitter>
<ilanpillemer> something like `StringScanner.new(STDIN.gets_to_end)`?
<FromGitter>
<rishavs> My monthly Bountysource for Crystal hasn't charged since Aug. ANyone else faced this issue?
<FromGitter>
<tenebrousedge> @ilanpillemer yes
<FromGitter>
<ilanpillemer> what is bountysource?
Nekka has joined #crystal-lang
<FromGitter>
<rishavs> its a way to donate to the community via a subscription model
<FromGitter>
<rishavs> If I have to retake a subscription, which one is better? Open collective or bountysource?
Nekka has quit [Ping timeout: 265 seconds]
Nekka has joined #crystal-lang
<FromGitter>
<kinxer> Does Crystal monomorphize generics or is there some cost to that which motivates not doing so?
<FromGitter>
<tenebrousedge> monomorphize?
<FromGitter>
<kinxer> Turn generic definitions of things into concrete definitions during compilation.
<FromGitter>
<tenebrousedge> yes, it does that
<FromGitter>
<kinxer> Solid. Thanks.
ht__ has quit [Quit: ht__]
OvermindDL1 has joined #crystal-lang
rohitpaulk has joined #crystal-lang
absolutejam2 has quit [Ping timeout: 240 seconds]
sagax has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
absolutejam2 has joined #crystal-lang
teardown has quit [Ping timeout: 276 seconds]
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
duane has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter>
<absolutejam_gitlab> Is there not currently a way to decompose a tuple on assignment?
<FromGitter>
<absolutejam_gitlab> `{a, b} = foo()` or `a, b = foo()`
<FromGitter>
<tenebrousedge> the second should work