Jump to page: 1 2 3
Thread overview
Overloaded terms
Aug 10, 2005
Derek Parnell
Aug 10, 2005
ElfQT
Aug 10, 2005
Ben Hinkle
Aug 10, 2005
AJG
Aug 10, 2005
Ben Hinkle
Aug 10, 2005
Vathix
Aug 10, 2005
Ben Hinkle
Aug 10, 2005
AJG
Aug 10, 2005
Ben Hinkle
Aug 10, 2005
AJG
Aug 10, 2005
xs0
Aug 11, 2005
Thomas Kühne
Aug 11, 2005
xs0
Aug 11, 2005
AJG
const: compile or runtime? [Was: Re: Overloaded terms]
Aug 12, 2005
Thomas Kühne
Aug 10, 2005
Ben Hinkle
Aug 10, 2005
AJG
Aug 11, 2005
Ben Hinkle
Aug 11, 2005
AJG
Aug 11, 2005
Shammah Chancellor
Aug 11, 2005
AJG
Aug 11, 2005
Stefan Zobel
Aug 11, 2005
Ben Hinkle
Aug 11, 2005
AJG
Aug 11, 2005
xs0
Aug 11, 2005
Stefan Zobel
Aug 11, 2005
Derek Parnell
Aug 10, 2005
Ben Hinkle
Re: Overloaded terms + suggestion
Aug 10, 2005
AJG
August 10, 2005
This is just a general gripe, so you can dismiss it if you want.

Is it just me, or are the terms 'static' and 'dynamic' a bit too overloaded in meaning.

'static' = compile-time processing
         = fixed-length arrays
         = never changing

'dynamic' = run-time processing
          = variable-length arrays
          = constantly changing

So when people use these words I can get confused about which meaning they are using ;-)

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
10/08/2005 4:50:10 PM
August 10, 2005
It's also confusing, that in context of Arrays, static means not dynamic
(declared fixed length),
and not static declaration like
# static int[] A1;

example:
#int[] A1 = [ 1, 2, 3, 4, 5 ];
#int[5] A2 = [ 1, 2, 3, 4, 5 ];
#
#int main(char[][] args)
#{
#    printf("sizeof staticA: [%d]\n", A1.sizeof);
#    printf("sizeof staticA: [%d]\n", A2.sizeof);
#    return 0;
#}

It's even more confusing, that .sizeof behaves differently on static and dynamic Array.

#int[] A1 = [ 1, 2, 3, 4, 5 ];
#int[5] A2 = [ 1, 2, 3, 4, 5 ];
#
#int main(char[][] args)
#{
#    Foo1(A1);
#    Foo1(A2);
#
#    //Foo2(A1); //invalid
#    Foo2(A2);
#
#    return 0;
#}
#
#void Foo1(int[] Ax)
#{
#    printf("Foo1 sizeof: [%d]\n", Ax.sizeof);
#}
#
#void Foo2(int[5] Ax)
#{
#    printf("Foo2 sizeof: [%d]\n", Ax.sizeof);
#}

How to call Foo2 with A1: how to cast/make static array/slice of a dynamic array?

ElfQT

"Derek Parnell" <derek@psych.ward> wrote in message news:6a4t1k8vh42r.1733y4ilwn4m5$.dlg@40tude.net...
> This is just a general gripe, so you can dismiss it if you want.
>
> Is it just me, or are the terms 'static' and 'dynamic' a bit too
overloaded
> in meaning.
>
> 'static' = compile-time processing
>          = fixed-length arrays
>          = never changing
>
> 'dynamic' = run-time processing
>           = variable-length arrays
>           = constantly changing
>
> So when people use these words I can get confused about which meaning they are using ;-)
>
> -- 
> Derek
> (skype: derek.j.parnell)
> Melbourne, Australia
> 10/08/2005 4:50:10 PM


August 10, 2005
"Derek Parnell" <derek@psych.ward> wrote in message news:6a4t1k8vh42r.1733y4ilwn4m5$.dlg@40tude.net...
> This is just a general gripe, so you can dismiss it if you want.
>
> Is it just me, or are the terms 'static' and 'dynamic' a bit too
> overloaded
> in meaning.
>
> 'static' = compile-time processing
>         = fixed-length arrays
>         = never changing
>
> 'dynamic' = run-time processing
>          = variable-length arrays
>          = constantly changing
>
> So when people use these words I can get confused about which meaning they are using ;-)
>
> -- 
> Derek
> (skype: derek.j.parnell)
> Melbourne, Australia
> 10/08/2005 4:50:10 PM

I agree about the static/dynamic array confusion. I remembe a recent thread with some suggestions and I hope Walter can find it and considers them. I can't find the thread now but I remember thinking some of the suggestions sounded better than today's vocabulary. Here's a suggestion for him: "dynamic array" becomes  "resizable array" and "static array" becomes "nonresizable array".


August 10, 2005
"Derek Parnell" <derek@psych.ward> wrote in message news:6a4t1k8vh42r.1733y4ilwn4m5$.dlg@40tude.net...
> This is just a general gripe, so you can dismiss it if you want.
>
> Is it just me, or are the terms 'static' and 'dynamic' a bit too
> overloaded
> in meaning.

I added a section on the Array doc wiki for names. Feel free to add more
suggestions.
http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Arrays#Namesstaticanddynamicconfusing


August 10, 2005
Hi,

>"Derek Parnell" <derek@psych.ward> wrote in message news:6a4t1k8vh42r.1733y4ilwn4m5$.dlg@40tude.net...
>> This is just a general gripe, so you can dismiss it if you want.
>>
>> Is it just me, or are the terms 'static' and 'dynamic' a bit too
>> overloaded
>> in meaning.
>>
>> 'static' = compile-time processing
>>         = fixed-length arrays
>>         = never changing
>>
>> 'dynamic' = run-time processing
>>          = variable-length arrays
>>          = constantly changing
>>
>> So when people use these words I can get confused about which meaning they are using ;-)
>>
>> -- 
>> Derek
>> (skype: derek.j.parnell)
>> Melbourne, Australia
>> 10/08/2005 4:50:10 PM
>
>I agree about the static/dynamic array confusion. I remembe a recent thread with some suggestions and I hope Walter can find it and considers them. I can't find the thread now but I remember thinking some of the suggestions sounded better than today's vocabulary. Here's a suggestion for him: "dynamic array" becomes  "resizable array" and "static array" becomes "nonresizable array".

ICK @ nonresizable. How about "fixed" instead?

Also, I agree with the gist of this thread. The terms are badly overloaded. "const" is also related because like "static" it can mean compile-time (a storage-class) or "never-changing" (though in D that's not yet available).

I say change "const" to mean neverchanging (which is the very definition of constant), and use some other word for the storage class. Hey, now that I think about it, you could use "fixed" for this too.

fixed int CompileTimeValue = 5;
const int RunTimeValue     = rand();
// Error: fixed expression needed:
fixed int RunTimeValue     = rand();

CompileTimeValue = 42; // Error: fixed expr.
RunTimeValue     = 42; // Error: const expr.

fixed int[3] CompileTimeArray = [1, 2, 3];
const int[3] RunTimeArray     = [rand(), rand(), rand()];
// Error: fixed expression needed:
fixed int[3] RunTimeArray     = [rand(), rand(), rand()];

CompileTimeArray[0] = 42; // Error: fixed expr. RunTimeArray    [0] = 42; // Error: const expr.

This way, static can then be made to mean exclusively "shared" in the sense "all instances share it," or "all function calls share it."

Comments?

================

Or, it the opposite could be done: fixed as neverchanging and const remains the storage class. But I prefer it the other way. It's more intuitive. Yes, I'm aware it breaks with C. Then again, D is not C.

Cheers,
--AJG.


August 10, 2005
"AJG" <AJG_member@pathlink.com> wrote in message news:ddd7cq$6of$1@digitaldaemon.com...
> Hi,
>
>>"Derek Parnell" <derek@psych.ward> wrote in message news:6a4t1k8vh42r.1733y4ilwn4m5$.dlg@40tude.net...
>>> This is just a general gripe, so you can dismiss it if you want.
>>>
>>> Is it just me, or are the terms 'static' and 'dynamic' a bit too
>>> overloaded
>>> in meaning.
>>>
>>> 'static' = compile-time processing
>>>         = fixed-length arrays
>>>         = never changing
>>>
>>> 'dynamic' = run-time processing
>>>          = variable-length arrays
>>>          = constantly changing
>>>
>>> So when people use these words I can get confused about which meaning
>>> they
>>> are using ;-)
>>>
>>> -- 
>>> Derek
>>> (skype: derek.j.parnell)
>>> Melbourne, Australia
>>> 10/08/2005 4:50:10 PM
>>
>>I agree about the static/dynamic array confusion. I remembe a recent
>>thread
>>with some suggestions and I hope Walter can find it and considers them. I
>>can't find the thread now but I remember thinking some of the suggestions
>>sounded better than today's vocabulary. Here's a suggestion for him:
>>"dynamic array" becomes  "resizable array" and "static array" becomes
>>"nonresizable array".
>
> ICK @ nonresizable. How about "fixed" instead?

To me "fixed" doesn't say what is fixed. Plus one can interpret "fixed" in different ways: fixed as in "not broken" or also fixed as in "neutered" (shudder). Since static arrays are less common in practice than dynamic arrays the unmodified word (resizable) will be used more often than the modified word (nonresizable).

> Also, I agree with the gist of this thread. The terms are badly
> overloaded.
> "const" is also related because like "static" it can mean compile-time (a
> storage-class) or "never-changing" (though in D that's not yet available).
>
> I say change "const" to mean neverchanging (which is the very definition
> of
> constant), and use some other word for the storage class. Hey, now that I
> think
> about it, you could use "fixed" for this too.
>
> fixed int CompileTimeValue = 5;
> const int RunTimeValue     = rand();
> // Error: fixed expression needed:
> fixed int RunTimeValue     = rand();
>
> CompileTimeValue = 42; // Error: fixed expr.
> RunTimeValue     = 42; // Error: const expr.
>
> fixed int[3] CompileTimeArray = [1, 2, 3];
> const int[3] RunTimeArray     = [rand(), rand(), rand()];
> // Error: fixed expression needed:
> fixed int[3] RunTimeArray     = [rand(), rand(), rand()];
>
> CompileTimeArray[0] = 42; // Error: fixed expr. RunTimeArray    [0] = 42; // Error: const expr.
>
> This way, static can then be made to mean exclusively "shared" in the
> sense "all
> instances share it," or "all function calls share it."
>
> Comments?

ICK :-)

> ================
>
> Or, it the opposite could be done: fixed as neverchanging and const
> remains the
> storage class. But I prefer it the other way. It's more intuitive. Yes,
> I'm
> aware it breaks with C. Then again, D is not C.
>
> Cheers,
> --AJG.
>
> 


August 10, 2005
>> ICK @ nonresizable. How about "fixed" instead?
>
> To me "fixed" doesn't say what is fixed. Plus one can interpret "fixed" in
> different ways: fixed as in "not broken" or also fixed as in "neutered"
> (shudder). Since static arrays are less common in practice than dynamic
> arrays the unmodified word (resizable) will be used more often than the
> modified word (nonresizable).

"Fixed-length" sounds good.

Instead of "dynamic array" or "resizable array" we could just say slice. A slice is a reference to array elements.
August 10, 2005
Hi,

>> ICK @ nonresizable. How about "fixed" instead?
>
>To me "fixed" doesn't say what is fixed. Plus one can interpret "fixed" in different ways: fixed as in "not broken" or also fixed as in "neutered" (shudder).

Oh, c'mon! By that same token, one can interpret "constant" to mean "faithful"! Look it up, I speak truths. Realistically though, fixed would come from "fixed-length," so it would be merely an abbreviation. In addition, it would be consistent with the docs, if the docs dropped the confusing "static" already.

>Since static arrays are less common in practice than dynamic arrays the unmodified word (resizable) will be used more often than the modified word (nonresizable).

The only way I see to avoid the ugly nonresizable is to make it implicit and then require resizable for everything else. But then you say resizable is more common, so that wouldn't fly.

>> Comments?
>
>ICK :-)

Touché! ;)

But how about the concept itself: That there are, and that we should have at our disposal, two distincts things:

1) A compile time, constant-foldable, declaration.
2) A run-time, dynamically set (once), neverchanging, readonly declaration.

If you agree, then it's just a matter of keywords then ;) I have an aversion to nonresizable, you to fixed. The solution is obvious and self-evident:

fixedlynonresizable int[] array;

;)

Cheers,
--AJG.


August 10, 2005
> But how about the concept itself: That there are, and that we should have
> at our
> disposal, two distincts things:
>
> 1) A compile time, constant-foldable, declaration.
> 2) A run-time, dynamically set (once), neverchanging, readonly
> declaration.
>

IMHO the current syntax is fine.


August 10, 2005
"Vathix" <chris@dprogramming.com> wrote in message news:op.svaw5xmgl2lsvj@esi...
>>> ICK @ nonresizable. How about "fixed" instead?
>>
>> To me "fixed" doesn't say what is fixed. Plus one can interpret "fixed"
>> in
>> different ways: fixed as in "not broken" or also fixed as in "neutered"
>> (shudder). Since static arrays are less common in practice than dynamic
>> arrays the unmodified word (resizable) will be used more often than the
>> modified word (nonresizable).
>
> "Fixed-length" sounds good.

We could pronounce "fixed-length array" as "fillay" (fillet).

Thinking along those lines a dynamic array reference can be called a "lointer" (length and pointer). For example "I'm passing an array lointer to function foo". :-)

> Instead of "dynamic array" or "resizable array" we could just say slice. A slice is a reference to array elements.

My only complaint with slice is that it tends to imply the existence of a reference array that this is the slice of. It would be like saying we don't need the word "set" once we have the word "subset".


« First   ‹ Prev
1 2 3