r/ProgrammingLanguages • u/yang_bo • Feb 27 '26
Requesting criticism Are functions just syntactic sugar for inheritance?
https://arxiv.org/abs/2602.16291
37
Upvotes
r/ProgrammingLanguages • u/yang_bo • Feb 27 '26
21
u/gasche Feb 27 '26
I am skeptical about the proof argument for Theorem A.3, that the lambda-calculus is less (macro-)expressive than the inheritance calculus. (I only skimmed the paper and did not study the definitions in details, so I don't know precisely what the inheritance calculus is, I am only looking at the proof structure.)
Felleisen's notion of macro-expressibility relates a programming language L0 and and extension L1 of L0, and asks whether L1 can be macro-expressed in L0. Note in particular that the interpretation of L0 must be stable by the translation.
What the proof of A.3 appears to say is that:
This may very well be correct, but I don't see how one would conclude from this that LC is not macro-expressible in IC. (In fact, unless I am missing something, the question of whether LC is or is not macro-expressible in IC in Felleisen's sense is not clearly defined because IC is not an extension of LC. I am assuming in the following that for two calculus that are not assumed to be in extension relation, "A is macro-expressible in B" means that there is a correct and structure-preserving/homeomorphic translation.)
(Nitpick: the proof takes a non-standard definition of "operational equivalence" for SC, whereas Felleisen's results always define operational equivalence as contextual equivalence, I am not sure that the tweak is formally correct.)
Here is an example of a similar situation where the same proof argument would be incorrect:
getandsetthat can access a single global memory cell.You can embed the pure lambda-calculus PLC into SLC (mapping lambda to lambda, application to application etc).
getandsetcannot be macro-expressed in this subset of SLC which has only lambdas, applications and variables. But it would be incorrect to conclude that there are no structure-preserving/homeomorphic translations from SLC to PLC, as the monadic translations do provide such translations.29
u/ineffective_topos Feb 27 '26
I think this needs a lot of work, and it's pretty indicative of someone who's not very knowledgeable.
The paper should not have any references to Turing machines. And it overstates its own importance, in the title and elsewhere. The lambda calculus embeds in a lot of things (like other machines, how compilers work) and while first-class functions are relevant, pure lambda calculus is not.
The section at "This induced semantics is more elementary than traditional approaches in the mathematical machinery it requires" is a red-flag, for not understanding the things it's referring to, and what semantics is.
I would focus on the details and presentation, try to get a concise formal definition. This seems like a curiosity, and a very opaque one at that, with no obvious reason why other people should care.
The biggest consistent issue is misunderstanding of the importance of properties. Just having different properties is not a significant improvement. Things like idempotence or commutativity can be detrimental by reducing expressiveness. The #1 priority should be to get the ideas across as clearly as possible. That includes both examples and detailed formal definitions.
7
u/hairytim Feb 27 '26
I wish the paper included an operational semantics. I think the paper is a bit confused about the purpose of an operational semantics, and emphasizes that this language does not compute with reduction rules, but this misses the mark for me. An operational semantics is just an interpreter. Being able to present one succinctly is a huge win for clarity.
In particular, the paper says:
An operational semantics would give a precise algorithm for the construction of this tree. Presumably, it would need to (lazily) unfold the definitions of the fields of the records, which could easily be expressed in terms of reduction rules. I highly recommend working through the details.
39
u/probabilityzero Feb 27 '26
This is a very interesting paper, despite the clickbait title.
1
u/asdfa2342543 Mar 01 '26 edited Mar 01 '26
Interesting idea, but i don’t understand how can you call inheritance commutative… it’s basically the poster child for a non-commutative operation. Without any specific definition otherwise, the base class’s methods get overridden. This is pretty much the exact opposite of commutativity… you justify it by claiming that these are sets, but they’re sets of (key,value) pairs, not sets of keys. So you can treat the operation as commutative if you keep both methods for the same key around, but then you’re not actually overriding things, you just have 2 methods with the same key and no obvious way to determine which to use when called, so that wouldn’t be a great model of inheritance.
3
u/jpfed Feb 27 '26
Haven’t had time to read it but it sounds like someone living in the Kingdom of Nouns made it their life philosophy
0
u/Arakela Feb 27 '26 edited Feb 27 '26
Here is TM specified in systems language, with four fundamental units of composition (the step), which proves (you can not merge any two roles) that you need four roles to have computation. I think you are missing something.
https://github.com/Antares007/tword/blob/main/rooted_tm.e.c#L8
ξ -> ρ -> ω -> δ -> ξ through the initial step, observe ρ reads [left ω, state, right ω] selects and steps, ω takes [state, δ] writes and steps, δ chooses state locus ξ and steps, state locus ξ locates and steps.
Note: state locus ξ is an ambiguous step because it provides more than one continuation. Those roles are irreducible in the fundamental cycle of computation. They have four distinct type signatures that cannot be unified without collapsing the cycle. Inheritance calculus does not account for its own steps; it delegates stepping to the metalanguage and is therefore incomplete as a foundational model.
1
u/moreVCAs Feb 27 '26
diabolical
1
u/apajx Feb 27 '26
Garbage science, will never be published in a reputable conference
-5
u/Arakela Feb 27 '26 edited Feb 27 '26
Here is TM specified in systems language, with four fundamental units of composition (the step), which proves (you can not merge any two roles) that you need four roles to have computation. I think you are missing something.
https://github.com/Antares007/tword/blob/main/rooted_tm.e.c#L8