HackerTrans
TopNewTrendsCommentsPastAskShowJobs

thetic

no profile record

comments

thetic
·2 năm trước·discuss
these kinds of things are already possible (albeit without animation) with native features:

- https://neovim.io/doc/user/pi_paren.html - https://neovim.io/doc/user/lsp.html#lsp-highlight
thetic
·3 năm trước·discuss
I don't even think that's a controversial opinion. Breaking convention isn't inherently bad; it has costs, some of which you described. In this case specifically, the novelty is not justified by any significant benefit.
thetic
·3 năm trước·discuss
If only there were a way to indicate the function argument isn't mutated. </s>

My spidey senses tingle whenever I see const-ness cast away because it almost always means something is wrong. Either a function is missing a qualifier on an argument, or something very unsafe is happening. Why force callers to cast away const-ness in hopes that everything will be fine when you can just write the correct function signature.
thetic
·3 năm trước·discuss
The legal cases in which he needs to cast away const could be avoided if the arguments to called functions were appropriately qualified.
thetic
·3 năm trước·discuss
> #define sizeof(x) (size)sizeof(x)

Undefined behavior[1]

> #define assert(c) while (!(c)) __builtin_unreachable()

Undefined behavior[1]

> I’ll cast away the const if needed.

Undefined behavior[2]

> The assignments are separated by sequence points, giving them an explicit order.

I don't believe assignments are sequence points and only the function call is.

[1] https://en.cppreference.com/w/c/language/identifier#Reserved...

[2] https://en.cppreference.com/w/c/language/const