From: cary@... Date: 2019-04-05T00:22:05+00:00 Subject: [ruby-core:92151] [Ruby trunk Misc#15744] Improvement needed to documentation of 'Literals' Issue #15744 has been updated by CaryInVictoria (Cary Swoveland). shevegen (Robert A. Heiler) wrote: ...I don't know myself either... Robert, I was only musing about a how a "literal" might be defined. My only point is that I think a definition is required, since the term is frequently used in discussing Ruby code. Alas, I don't think it's possible to define anything by example, and while I'm not convinced that a satisfactory definition is within reach, I believe it's worth a try. ---------------------------------------- Misc #15744: Improvement needed to documentation of 'Literals' https://bugs.ruby-lang.org/issues/15744#change-77478 * Author: CaryInVictoria (Cary Swoveland) * Status: Open * Priority: Normal * Assignee: ---------------------------------------- Documentation of "Literals" for v2.6.0 is given here: https://docs.ruby-lang.org/en/2.6.0/syntax/literals_rdoc.html. (I don't think it has been changed for some time.) It gives examples of literals but does not provide a definition. It is comparable to defining an array by giving a few examples. I believe a definition is needed. I would like to suggest a definition, but I confess I don't know what a Ruby literal is. A definition is attempted at this Wiki for computer programming generally: https://en.wikipedia.org/wiki/Literal_(computer_programming). I suspect a Ruby literal is an object whose value is in some sense "known" at compile-time. For example, I would think `1`, `1.0` and `{ a: [1, 'cat', ['dog', ['pig', ..10]]] }` are literals but `{ v=>1, 2=>3 }` in `h = { v=>1, 2=>3 }`, `v` being a variable, is not. Or is it? If the previous line of code had been `v=3`, Ruby could, at compile-time, infer that the line could be replaced with `h = {3=>1, 2=>3}`, in which case it would be "known". This example is meant to illustrate why I earlier said "in some sense". -- https://bugs.ruby-lang.org/ Unsubscribe: