Viewing profile — dctwin
dctwin
HN member- Joined
- Sat, Sep 23, 2023, 12:35 PM UTC
- HN karma
- 77
- Public activity
- 18 items
- HN profile
- View on Hacker News ↗
About dctwin
No profile information was provided.
Recent public activity
-
comment
Comment #48991687
Am I reading this right? Opus + Composer did a comparable job to Fable, at ~1/19th the price, and half the LoC?
-
comment
Comment #47747794
The layoffs haven't even really started yet... I'm very worried about the next two years
-
comment
Comment #40944364
Oh I think I finally groked what you suggested! Something like template static constexpr Key key in the class namespace - I think this this would work, but if I understand this cor…
-
comment
Comment #40934045
Whether or not this is useful (I am also not sure), the JSON doesn't need to survive into runtime at all. If you include the JSON, do a bunch of `if constexpr`, and never touch the…
-
comment
Comment #40931155
Yes, very true. I noticed that even already at 3dp the floats start to compare unequal. The long double helped but it's not really. I googled and found two examples of constexpr fl…
-
comment
Comment #40928086
You're right to point out that this is really 'first class JSON', rather than the Pydantic/Jackson type thing where the json barely exists and is immediately transformed into your …
-
comment
Comment #40926550
The opposite 'toString' problem seems harder - I didn't try, but it should be possible now that std::string is constexpr. I don't think you could parse it with, say, a class that h…
-
comment
Comment #40926455
You can do something similar, no? std::pow is not constexpr (most float stuff is not, presumably due to floating point state) but you can implement 10^x anyway
-
comment
Comment #40925530
Despite my writing the article I agree
-
comment
Comment #40925522
Thanks for the idea! Yes constexpr std::vector feels like cheating
-
comment
Comment #40925513
Yes, the nonconstexpr version does just that, unless I misunderstood your question. See also boost::spirit for a 'big' version of this
-
comment
Comment #40925396
Hm - so this would instantiate a variable for each key in the class namespace? I admit I haven't seen anything like this but sounds very interesting
-
comment
Comment #40925329
I was able to do the primitive long double result = 0.0; while (...) { if (json[head] == '.') ... result *= 10; result += json[head] - '0'; } in a constexpr function with no proble…
-
comment
Comment #40925285
Yes, I agree. I don't see much practical use in this. I was just surprised how (relatively) straightforwards this is to do, and thought it was more cool than useful
-
comment
Comment #40925269
Thank you!
-
comment
Comment #40889273
Hello! I wrote this short blog post about using pattern-matching-like template metaprogramming to deserialize JSON at build time - please let me know what you think (especially if …
- story
- story