commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafał Krupiński <r.krupin...@gmail.com>
Subject Re: Pointers
Date Mon, 03 Jan 2011 19:52:32 GMT
W dniu 03.01.2011 20:15, Stephen J. Butler pisze:
> 2011/1/3 Rafał Krupiński<r.krupinski@gmail.com>:
>> W dniu 03.01.2011 18:45, Michael Giannakopoulos pisze:
>>>
>>> Hello to all Apache Commons Developers!
>>> I wish a happy new year and i hope that all your expectations will come
>>> true! I would like to propose a new feature in apache commons... Wouldn't
>>> it
>>> be great if commons api provided a pointer operator (like ref in C#) so as
>>> to pass arguments in functions by references (only for primitive types...)
>>> and these arguments to change values... I would like to hear your thoughts
>>> on this! Thanks for your time!
>>>
>>
>> Do you mean something like
>> class IntRef{
>> private int value;
>> public int getValue()...
>> public void setValue(int)...
>> }
>>
>> ?
>
> He mentions "ref" in C#, which works something like this:
>
> public function foo( ref int a ) { a = 42; }
> public function bar() {
>    int b = 0;
>
>    foo( ref b );
>
>    // b == 42
> }
>
> I don't see how Commons could accomplish this goal.

Well, obviously you can't introduce operators with libraries, after all 
java ain't perl ;-)

The simplest way to achieve anything resembling output parameters are 
mutable flavor of java.lang.Integer &co classes.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message