3 ms·
Do you mean direct/indirect objects as in French grammar: Le père donne la clé à la voisine ("The father gives the key to the neighbour"; father: subject, key:
by limmeau 16y ago
Do you mean direct/indirect objects as in French grammar: Le père donne la clé à la voisine ("The father gives the key to the neighbour"; father: subject, key: direct object, neighbour: indirect object)?
Corresponding OO code:
father.give(key, neighbour)
And objects (in the grammatical sense) with preposition could be understood to correspond to keyword arguments:
father.give(key, to=neighbour)
Now if we introduced cases to a programming language...
- cammil 16y agoYes, that is actually what I meant to convey. I should have said that methods should be verbs, and that they should be methods of the subject (not direct object). And that parameters should be linguistic objects, direct or otherwise. PS. Cases, I hadn't even considered that. My feeling is that methods should be imperatives. They tend to be anyway. I haven't given much thought though.
- limmeau 16y agoCases and prepositions both signify into which 'slot' of a verb this object goes. From that perspective, if prepositional objects correspond to keyword args, so do cases. On the other hand, a case is a form of the noun-phrase which can be constructed without looking at the predicate. I see a similarity to the address operator in C: foo(bla, &blub) means that bla is passed in value-case, whereas blub is passed in reference-case.