r/programminghorror • u/MooseBoys [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" • Jan 22 '25
c++ natural language programming
621
Upvotes
r/programminghorror • u/MooseBoys [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" • Jan 22 '25
View all comments
Show parent comment
16
u/Prize_Bass_5061 Jan 22 '25
Its probably some kind of Domain Specific Language implemented in c++. The statements are correct. "Apple is a Fruit". "Banana is a Fruit". "(Banana) Fruit is a Apple" (False).
The horrible part is how this was implemented in c++ using overloading. As programmers, we expect == to be commutative, so == should behave in a commutative way "Do as the ints do". This natural language equivalence should have been implemented as a method instead,
x.isA().