In all programming languages, every command is sorted as command-arguments. For instance, in pygame, the command to draw a rectangle to the screen is:
pygame.draw.rect(surface,color,rect)
This seems rather odd to me thinking about it. Wouldn't a verb-final (or command-final if you prefer) order make more sense? For instance, what if the order of the previous instruction were:
main_window-x-y-location rectangle-green-100-by-100 object draw
First, the data to be utilized is stated, then the location in question, then what should be done with the data. Putting the command at the end like this also clearly indicates to the computer where the instruction ends, avoiding the need for things like tabs or brackets just so the interpreter/compiler won't confuse lines. This is actually one of the practical advantages of such an order in real languages. Inflected verbs always go at the end of a clause, so its obvious where the end of each clause is.
It just seems to me that this would be a better way to give instructions to something. Why then do no languages do this? Even thinking about the lowest level of how programs work, it sorta is verb-final. For instance, to place some data somewhere in memory, first you tell the program to load something into the accumulator, then tell it to transfer it somewhere (there's multiple reasons to load something into an accumulator other than transferring them to a location in memory).
Why is it this order is always chosen? Is it because western languages tend to be subject-verb-object, thus imperatives are verb-object? What about programming languages developed by cultures like the Japanese who do use a verb-final order? What is the syntax of their programming languages? Why is there so much preference for this command-arguments order?
add rbx, 8
– user1937198 Feb 28 '24 at 00:21system.subsystem.action
. It's much more useful to have all drawing routines grouped into one system (draw
), rather than the other way round, grouping things byrect
first anddraw
last. However for other cases, e.g.rect.rotate
it makes sense, since rotate is not big enough to be a whole own subsystem. – Kromster Feb 28 '24 at 07:50I want a cake. Bake it.
but you sayBake me a cake.
, so isn't it just natural to put the verb first? – Dominique Feb 28 '24 at 08:46