Tristan B. Velloza Kildaire on Nostr: You can learn a lot by just playing around. Today I learnt that the :: operator's ...
You can learn a lot by just playing around. Today I learnt that the :: operator's implementation for list types ('a list) is to evaluate the right-hand side first and only then evaluate the left-hand side.
This lead to an interesting bug which is only noticeable when you realise that order of operations
#ocaml
Published at
2024-06-06 17:00:03Event JSON
{
"id": "0bacd27b79a8e7157e1d6e9ce24a92bb40e132e82341d7e6c606bf1e383d7d4f",
"pubkey": "8dda1f9d2b468a4a41a625ea6dad76c33b4f56cae92c707eb0fee2ce0c574ce5",
"created_at": 1717693203,
"kind": 1,
"tags": [
[
"t",
"ocaml"
],
[
"proxy",
"https://gleasonator.com/objects/a3e92d0b-85e1-4c2a-abcf-3a3b37eb1c0b",
"activitypub"
]
],
"content": "You can learn a lot by just playing around. Today I learnt that the :: operator's implementation for list types ('a list) is to evaluate the right-hand side first and only then evaluate the left-hand side.\n\nThis lead to an interesting bug which is only noticeable when you realise that order of operations\n\n#ocaml\n\nhttps://media.gleasonator.com/ecf8d430164431759da11bb499b1486eebbbfa229ead6c42d1d22f49a40a804c.png\n\nhttps://media.gleasonator.com/51c314c1a1ad93b64d2d3100d8deaaad46c2595dde5daeba7b88214213bf47bd.png",
"sig": "5baf5fdcec597d44bd1d3d57aec0ff501e2f7ff9cef2406cd03225545475e4b804b7cbf4eebb40dc0a1cb1ac38a0476efd8e9a4cfeccdd88d2a7a36ee818a863"
}