4 ms·
Your examples have the things on the right and the type on the left, and then used it to describe why examples on the left and [types] on the right makes sense.
by hinkley 7y ago
Your examples have the things on the right and the type on the left, and then used it to describe why examples on the left and [types] on the right makes sense...
If anything you've just argued that
String: x, y
is a preferable declaration style.
- djur 7y agoThe point of the list isn't to say "eggs and bacon is a kind of breakfast", it's to say "breakfast is eggs and bacon". It's "name: details about name", not "type: instance".
- htfu 7y agoWouldn’t that argue in favor of val breakfast: “eggs and bacon” = String and not val breakfast: String = “eggs and bacon”
- djur 7y agoMy intention was solely to counter the idea that using ":" to mean "is" or "is a" is somehow inconsistent with written English. I don't think it's always necessary or even desirable to match the use of symbols in programming with English orthography, in any case. The use of a declaration with initialization as the example here muddies the water. Whatever syntax you use has to work for uninitialized declaration of variables, function arguments, and structure members: val breakfast: String fun serveBreakfast(breakfast: String) struct MealPlan { breakfast: String } Declaration with initialization just needs to be consistent with these.