Adam Ruppe:
> > The high usage frequency of "immutable" suggests its shortening
> > according to Zipf law (http://en.wikipedia.org/wiki/Zipf%27s_law )
>
> I don't see anything in that article relating to number of letters
> in a word.
You are right, Zipf's law is about something related but diff
On 12/30/2010 11:10 PM, KennyTM~ wrote:
On Dec 30, 10 20:23, Stanislav Blinov wrote:
30.12.2010 15:05, bearophile пишет:
Peter Alexander:
but val is far too vague. It does not suggest that the value is
immutable at all.
In Scala you tag assignments with "val" or "var". "var" means
variable,
bearophile wrote:
Adam Ruppe:
bearophile wrote:
writing "immutable" often is boring and makes code longer.
im -> immutable
That doesn't shorten the code.
You did say "writing" implying the act of typing it was the problem.
I prefer something like "val", it's shorter to write, uses l
On Dec 30, 10 20:23, Stanislav Blinov wrote:
30.12.2010 15:05, bearophile пишет:
Peter Alexander:
but val is far too vague. It does not suggest that the value is
immutable at all.
In Scala you tag assignments with "val" or "var". "var" means
variable, and "val" means value, it's not mutable.
bearophile wrote:
> That doesn't shorten the code.
Completely irrelevant. We're not playing code golf. What matters
is: a) Is it easy to change? and b) Is it clear to read?
immutable is easy to change. It's just one word. immutable is clear
to read, it says what it means.
> [val is] clear enough
Adam Ruppe:
> bearophile wrote:
> > writing "immutable" often is boring and makes code longer.
>
> im -> immutable
That doesn't shorten the code.
> btw you might say "an editor is no excuse for bad language design"
> but this isn't bad language design, it's just a preference on your
> part.
On Thu, 30 Dec 2010 15:15:32 + (UTC)
Adam Ruppe wrote:
> > My guess is programmers spend ~ half of their time thinking, a
> > quarter of their time controlling & another quarter fixing;
> > the rest, typing.
>
> I don't know about that! If my personal vices are any indication,
> it is more
For what it's worth invariant still works. It's a nice keyword, but we
already use it for class invariants. I prefer immutable over "val",
it's much more explicit and noticable in code and you'll never mistake
it for anything else since it's not a made up word. Plus you don't
have to do a "translat
spir wrote:
> Actually, do you know any editor _without_ this feature?
Notepad! I don't think elvis or gedit do either, all three of
which I've used for code in the past.
> But the actual issue is not about time at all, instead plain
> human laziness
There is more to it than laziness - it is fru
On Thu, 30 Dec 2010 13:19:52 + (UTC)
Adam Ruppe wrote:
> === back to the main point ===
>
> Of course, I'm sure there's dozens of editors with a similar feature.
> There might also be an existing option or plugin in your current
> editor of choice. It's worth investigating.
Actually, do yo
On Thu, 30 Dec 2010 05:55:13 -0500
bearophile wrote:
> An alternative is to use Go syntax, and use the Pascal-like ":=" to denote a
> value assignment (function signature can't use := ).
> Here there is another idea from Go syntax: if the "then" clause of the "if"
> uses {} then the () around t
bearophile wrote:
> writing "immutable" often is boring and makes code longer.
im -> immutable
Really, I think you *desperately* need to get a better editor. Once
you get one with a decent auto-complete, you'll never care
about typing out 'boring' words again.
=== recommendation and sermon he
Sigils may be another solution. I've been a fan of them in Perl/PHP for
various reasons and I think that they should be considered here, though
maybe not in the same way. Here are a couple possible examples using
bearophile's first example:
void foo(int $y) {
$x = 5;
if (i > $x) {
On 2010-12-30 05:55:13 -0500, bearophile said:
void foo(immutable int y) {
immutable x = 5;
if (i > x) {
writeln(x);
}
if (i > x)
writeln(x);
}
In this example, 'x' is a compile-time constant so you can use 'enum'
if you want it to be shorter. :-)
--
Michel
30.12.2010 15:05, bearophile пишет:
Peter Alexander:
but val is far too vague. It does not suggest that the value is immutable at
all.
In Scala you tag assignments with "val" or "var". "var" means variable, and "val" means value, it's not
mutable. I agree that "immutable" is a bit more expli
Peter Alexander:
> but val is far too vague. It does not suggest that the value is immutable at
> all.
In Scala you tag assignments with "val" or "var". "var" means variable, and
"val" means value, it's not mutable. I agree that "immutable" is a bit more
explicit than "val", but I think "val"
On 30/12/10 10:55 AM, bearophile wrote:
So using "val" (abbreviation for "value") as in Scala seems better to me:
I agree that writing immutable all the time is tedious, but val is far
too vague. It does not suggest that the value is immutable at all.
An alternative is to use Go syntax, and
Time ago with other people I have asked to replace the keyword "invariant" with
"immutable" to create a run-time constant. But that wasn't the best choice
because now in my functions I am using many immutable values; writing
"immutable" often is boring and makes code longer. This is normal D2 co
18 matches
Mail list logo