Read-only array reference
Hasan Aljudy
hasan.aljudy at gmail.com
Sun Jul 9 12:16:51 PDT 2006
Bruno Medeiros wrote:
> Hasan Aljudy wrote:
>
>>
>>
>> Bruno Medeiros wrote:
>>
>>> Hasan Aljudy wrote:
>>
>> <snip proposal>
>>
>>>>
>>>> So, what do you think about this proposal?
>>>> Is it practical? Does it solve most of the const issues?
>>>> Does it even make sense, or is it just stupid all-together?
>>>>
>> <snip>
>>
>>>
>>>
>>> Indeed, if I understood your proposal correctly, I think it is
>>> unpractical, if not down-right senseless. :p
>>>
>>> Why?
>>> Ok, first, what do we want exactly? We want a mechanism that allows
>>> us to specify a readonly contract for a variable, that is, declare a
>>> variable (or function parameter) that should be a "read-only view"
>>> (using Andrei Alexandrescu's term) of another data/object.
>>
>>
>> No, if you check my proposal, it was a reply to kris's statement:
>> "this whole discussion is basically about array types, since others
>> can happily be passed by value anyway."
>>
>> and that is also my understanding.
>>
>
> If that is your premise,then that system would work for it, but I don't
> agree with such a premise. I have to say I didn't understand Kris's
> context in the surroundings statements, like the "Using an aggregate
> (struct or class) instead would give you the /propogation/ aspect
> required. This is in contrast to Walter's proposal, but requires the use
> of aggregates rather than, say, an array.", but in any case it seems to
> me an immutability mechanism is needed for any kind of reference type,
> like Objects too, not just arrays.
> I mean, if I have a function that has an Object parameter and I want to
> specify and enforce that the Object should not be changed in the
> function, what am I supposed to do?
>
>
>>>
>>> BTW, Javari is the Java modification described in that paper, which
>>> has reference immutability added to the Java language.
>>>
>>
>> I need to ask .. what did javari *really* add to java?
>> Is there something that's impossible with java but possible with javari?
>>
>> ..
>> ..
>> ..
>>
>> no?
>> I thought so.
>
>
> Impossible? No, not in the strict sense.
> But "better", "more powerful", "more expressive", etc., then yes, in my
> opinion it does.
>
> Do refrain from using the word "possible" in comparisons between
> languages. You'll be asking for the typical reply that any Turing
> complete language can do the same things as any other such language, so
> we might as well be using Assembler.
>
What I meant is .. Java already has one of the most powerfull libraries
I've seen (not that I've seen much anyways, mind you).
I was wondering what does javari has to offer that java doesn't? or let
me say, what does it add?
When we talk about 'possibilities' in this context, we're not talking
about algorithms.
I mean for instance, in the C langauge:
void x( int * p );
It's impossible for the function x to detect whether p points to an
array or just a single int. and if it's array, it's impossible to know
the size of the array.
More information about the Digitalmars-d-learn
mailing list