by dnautics · 9mo ago · 0 comments
The c form of `type name;` is ambiguous because it could actually be more than one thing depending on context. Even worse if you include macro sheananigans. The alternate (~rust/zig) is `var/const/mut name type` is unambiguous.
For humans, with rather long memory of what is going on in the codebase, this is ~"not a problem" for experts. But for an LLM, its knowledge is limited to the content that currently exists in your context, and conventions baked in with the training corpus, this matters. Of course it is ALSO a problem for humans if they are first looking at a codebase, and if the types are unusual.
Like which do you think is more token-efficient?
1)
<tool-call write_code "my_function(my_variable)"/>
2) <tool-call available_functions/>
resp:
<option> my_function </option>
<option> your_function </option>
<option> some_other_function </option>
<option> kernel_function1 </option>
<option> kernel_function2 </option>
<option> imported_function1 </option>
<option> imported_function2 </option>
<option> ... </option>
<tool-call write_function_call "my_function"/>
resp:
<option> my_variable </option>
<option> other_variable_of_same_type </option>
<tool-call write_variable "my_variable"/>LLMs are notoriously bad at counting.
Not much different from what agents already do today inside of their harnesses, just without the part where they have to read entire files to find the definition of one thing.
So far enabling LSP in Claude only added messages like "this is old diagnostic before my edit".
foo * bar;
Is that multiplication? Or a declaration of type foo*?
A similar claim, equally not related to type declarations, is with & that serves two roles as a boolean operator and address-of, that makes (foo)&bar ambiguous.
The list of C symbols that have been badly chosen at the beginning and now it's too late to correct continues with && for logical and, that prevents masking an address-of without adding spaces or parentheses in ``mask & &var``, /* for comments, that prevents dividing by a dereferenced value without adding spaces or parentheses in ``*a / *b``, the pre-increment ``--`` that is indistinguishable from a double application of the unary minus, and the original =+ etc. that have been later changed to += etc.