Reassignment to Val

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Reassignment to Val

by Joob () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello everyone,

I'm new to scala so please don't take anything for granted with me :)

Anyway,
I'm getting this error "Reassignment to val"

Let me explain the context : My application is a simple phonebook and a few commands on it
I have a list of Adress, which is empty at first, but you can fill it up eventually with user input entries.

Since lists cannot be modified, the code I'm writing for the "add entry function" goes something like this:

I create a new Adress object from user input
I put it in a List by itself
I create a new List from the Phonebook List where I filter out an identical entry to the one I'm about to put in
I merge the two new Lists
I try to do something like : PhonebookList = newList

this is where I get my error.
Everything up to there seems fine.

I'm guessing this is because i try to modify an existing list,
how can i work around this ?

Re: Reassignment to Val

by Kevin Wright-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

can you post the actual code snippet where this is happening?

On Mon, Jul 6, 2009 at 11:22 PM, Joob <travaildereligion@...> wrote:

Hello everyone,

I'm new to scala so please don't take anything for granted with me :)

Anyway,
I'm getting this error "Reassignment to val"

Let me explain the context : My application is a simple phonebook and a few
commands on it
I have a list of Adress, which is empty at first, but you can fill it up
eventually with user input entries.

Since lists cannot be modified, the code I'm writing for the "add entry
function" goes something like this:

I create a new Adress object from user input
I put it in a List by itself
I create a new List from the Phonebook List where I filter out an identical
entry to the one I'm about to put in
I merge the two new Lists
I try to do something like : PhonebookList = newList

this is where I get my error.
Everything up to there seems fine.

Can anyone help me ?
--
View this message in context: http://www.nabble.com/Reassignment-to-Val-tp24363871p24363871.html
Sent from the Scala - User mailing list archive at Nabble.com.



Re: Reassignment to Val

by Joob :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

var tempAdr = new Adresse(tempNom, tempNum, tempRue, tempVille);
        var tempAdreListe = List(tempAdr)

        var tempB = botin.filter(n => n.individu != tempNom);
        var resultat = tempB ::: tempAdreListe;

        botin = resultat


The variable names I use are in french
sorry :(
but its not very complicated I believe

Kevin Wright-4 wrote:
can you post the actual code snippet where this is happening?

On Mon, Jul 6, 2009 at 11:22 PM, Joob <travaildereligion@hotmail.com> wrote:

>
> Hello everyone,
>
> I'm new to scala so please don't take anything for granted with me :)
>
> Anyway,
> I'm getting this error "Reassignment to val"
>
> Let me explain the context : My application is a simple phonebook and a few
> commands on it
> I have a list of Adress, which is empty at first, but you can fill it up
> eventually with user input entries.
>
> Since lists cannot be modified, the code I'm writing for the "add entry
> function" goes something like this:
>
> I create a new Adress object from user input
> I put it in a List by itself
> I create a new List from the Phonebook List where I filter out an identical
> entry to the one I'm about to put in
> I merge the two new Lists
> I try to do something like : PhonebookList = newList
>
> this is where I get my error.
> Everything up to there seems fine.
>
> Can anyone help me ?
> --
> View this message in context:
> http://www.nabble.com/Reassignment-to-Val-tp24363871p24363871.html
> Sent from the Scala - User mailing list archive at Nabble.com.
>
>
var tempAdr = new Adresse(tempNom, tempNum, tempRue, tempVille);
        var tempAdreListe = List(tempAdr)

        var tempB = botin.filter(n => n.individu != tempNom);
        var resultat = tempB ::: tempAdreListe;

        botin = resultat

Re: Reassignment to Val

by Randall Schulz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday July 6 2009, Joob wrote:
> Hello everyone,
>
> I'm new to scala so please don't take anything for granted with me :)

Well, you see, computers are these electronical machines that we use to
make like difficult for others...


> Anyway,
> I'm getting this error "Reassignment to val"

A "val" is an "immutable" record of a value. By immutable we mean it
cannot be reassigned. There are lots of positive virtues to defining
programs in terms of immutable data, but it's sometimes challenging to
do so. Unlike Haskell, which is considered a "pure" functional language
that strictly forbids such "side-effects" and "mutable state," Scala
doesn't force you to use immutable data. When you feel the need to be
able to reassign the value in a field or local variable (or function /
method parameter), you can use a "var" instead of a val.


> ...
>
> Can anyone help me ?

Anything could happen...


Randall Schulz

Re: Reassignment to Val

by Randall Schulz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday July 6 2009, Joob wrote:

> var tempAdr = new Adresse(tempNom, tempNum, tempRue, tempVille);
>         var tempAdreListe = List(tempAdr)
>
>         var tempB = botin.filter(n => n.individu != tempNom);
>         var resultat = tempB ::: tempAdreListe;
>
>         botin = resultat
>
>
> The variable names I use are in french
> sorry :(
> but its not very complicated I believe

Where does the diagnostic occur? Where and how is "botin" declared?


Randall Schulz

Re: Reassignment to Val

by Joob :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well,

I declared the list as a "var" in my main

However it is a function parameter where I have the error

What do I have to do to make sure it stays a "var" and not a "val" ?
(If that is what I have to do, maybe I'm misunderstanding)


Randall Schulz wrote:
On Monday July 6 2009, Joob wrote:
> Hello everyone,
>
> I'm new to scala so please don't take anything for granted with me :)

Well, you see, computers are these electronical machines that we use to
make like difficult for others...


> Anyway,
> I'm getting this error "Reassignment to val"

A "val" is an "immutable" record of a value. By immutable we mean it
cannot be reassigned. There are lots of positive virtues to defining
programs in terms of immutable data, but it's sometimes challenging to
do so. Unlike Haskell, which is considered a "pure" functional language
that strictly forbids such "side-effects" and "mutable state," Scala
doesn't force you to use immutable data. When you feel the need to be
able to reassign the value in a field or local variable (or function /
method parameter), you can use a "var" instead of a val.


> ...
>
> Can anyone help me ?

Anything could happen...


Randall Schulz

Re: Reassignment to Val

by Joob :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

the error occurs at

botin = resultat

Randall Schulz wrote:
On Monday July 6 2009, Joob wrote:
> var tempAdr = new Adresse(tempNom, tempNum, tempRue, tempVille);
>         var tempAdreListe = List(tempAdr)
>
>         var tempB = botin.filter(n => n.individu != tempNom);
>         var resultat = tempB ::: tempAdreListe;
>
>         botin = resultat
>
>
> The variable names I use are in french
> sorry :(
> but its not very complicated I believe

Where does the diagnostic occur? Where and how is "botin" declared?


Randall Schulz

Re: Reassignment to Val

by Randall Schulz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday July 6 2009, Joob wrote:
> the error occurs at
>
> botin = resultat

Then I venture to guess that it is the val that you need to make a var.

In fact, I know it is, 'cause a statement like that in isolation will
alway be illegal for a val, since they get their values at the point of
declaration, never later.


Randall Schulz

Re: Reassignment to Val

by Randall Schulz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday July 6 2009, Joob wrote:
> Well,
>
> I declared the list as a "var" in my main
>
> However it is a function parameter where I have the error
>
> What do I have to do to make sure it stays a "var" and not a "val" ?
> (If that is what I have to do, maybe I'm misunderstanding)

You may prefix a formal parameter name with "var" to make it
reassignable.


Randall Schulz

Re: Reassignment to Val

by Daniel Sobral :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If it is a function parameter, then the main's botin is no longer visible. When you "change" botin, you are trying to change the function parameter, which is not possible (no workaround either).
 
You should use the full path when trying to change botin:
 
scala> object a {
     | var x = 0;
     | def f(x: Int) = { a.x = x }
     | }
defined module a
scala> a.x
res18: Int = 0
scala> a.f(5)
scala> a.x
res20: Int = 5
 
See how I access a's x inside f?
 
By the way, by changing the a "global" variable from inside a function you are doing the worst possible sin known to functional programming. Scala allows you to do that, but I advise you to try to change that.

On Mon, Jul 6, 2009 at 7:38 PM, Joob <travaildereligion@...> wrote:

Well,

I declared the list as a "var" in my main

However it is a function parameter where I have the error

What do I have to do to make sure it stays a "var" and not a "val" ?
(If that is what I have to do, maybe I'm misunderstanding)



Randall Schulz wrote:
>
> On Monday July 6 2009, Joob wrote:
>> Hello everyone,
>>
>> I'm new to scala so please don't take anything for granted with me :)
>
> Well, you see, computers are these electronical machines that we use to
> make like difficult for others...
>
>
>> Anyway,
>> I'm getting this error "Reassignment to val"
>
> A "val" is an "immutable" record of a value. By immutable we mean it
> cannot be reassigned. There are lots of positive virtues to defining
> programs in terms of immutable data, but it's sometimes challenging to
> do so. Unlike Haskell, which is considered a "pure" functional language
> that strictly forbids such "side-effects" and "mutable state," Scala
> doesn't force you to use immutable data. When you feel the need to be
> able to reassign the value in a field or local variable (or function /
> method parameter), you can use a "var" instead of a val.
>
>
>> ...
>>
>> Can anyone help me ?
>
> Anything could happen...
>
>
> Randall Schulz
>
>

--
View this message in context: http://www.nabble.com/Reassignment-to-Val-tp24363871p24364035.html
Sent from the Scala - User mailing list archive at Nabble.com.




--
Daniel C. Sobral

Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.

Re: Reassignment to Val

by Randall Schulz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday July 6 2009, Randall R Schulz wrote:

> On Monday July 6 2009, Joob wrote:
> > Well,
> >
> > I declared the list as a "var" in my main
> >
> > However it is a function parameter where I have the error
> >
> > What do I have to do to make sure it stays a "var" and not a "val"
> > ? (If that is what I have to do, maybe I'm misunderstanding)
>
> You may prefix a formal parameter name with "var" to make it
> reassignable.

That was a lie.

I was thinking of primary constructor parameters, which may be prefixed
by val or var to create fields directly.


Randall Schulz

Re: Reassignment to Val

by Joob :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Daniel Sobral wrote:
If it is a function parameter, then the main's botin is no longer visible.
When you "change" botin, you are trying to change the function parameter,
which is not possible (no workaround either).

You should use the full path when trying to change botin:

scala> object a {
     | var x = 0;
     | def f(x: Int) = { a.x = x }
     | }
defined module a
scala> a.x
res18: Int = 0
scala> a.f(5)
scala> a.x
res20: Int = 5

See how I access a's x inside f?

By the way, by changing the a "global" variable from inside a function you
are doing the worst possible sin known to functional programming. Scala
allows you to do that, but I advise you to try to change that.

So, if i understand correctly (and that's a pretty big if), I should have a class that has the List as a parameter and a function that allows me to change it ?  Then if I pass the object as a parameter I can still use the function to make the changes i want ?  Won't I have the same problem as before ?

And I'm not sure how to change my code so I can avoid commiting the worst possible sin in functional programming :(

Parent Message unknown Re: Reassignment to Val

by Naftoli Gugenheim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What language(s) are you coming from?

-------------------------------------
Joob<travaildereligion@...> wrote:




Daniel Sobral wrote:

>
> If it is a function parameter, then the main's botin is no longer visible.
> When you "change" botin, you are trying to change the function parameter,
> which is not possible (no workaround either).
>
> You should use the full path when trying to change botin:
>
> scala> object a {
>      | var x = 0;
>      | def f(x: Int) = { a.x = x }
>      | }
> defined module a
> scala> a.x
> res18: Int = 0
> scala> a.f(5)
> scala> a.x
> res20: Int = 5
>
> See how I access a's x inside f?
>
> By the way, by changing the a "global" variable from inside a function you
> are doing the worst possible sin known to functional programming. Scala
> allows you to do that, but I advise you to try to change that.
>
>
>
>

So, if i understand correctly (and that's a pretty big if), I should have a
class that has the List as a parameter and a function that allows me to
change it ?  Then if I pass the object as a parameter I can still use the
function to make the changes i want ?  Won't I have the same problem as
before ?

And I'm not sure how to change my code so I can avoid commiting the worst
possible sin in functional programming :(

--
View this message in context: http://www.nabble.com/Reassignment-to-Val-tp24363871p24366622.html
Sent from the Scala - User mailing list archive at Nabble.com.


Re: Reassignment to Val

by Joob :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Java, Actionscript, Ruby
Theyre all object oriented, I guess that's why I have trouble with functional programing

However Scala has some object oriented features as well as functional so I thought it wouldn't be too complicated, but anyway...


Naftoli Gugenhem wrote:
What language(s) are you coming from?

-------------------------------------
Joob<travaildereligion@hotmail.com> wrote:




Daniel Sobral wrote:
>
> If it is a function parameter, then the main's botin is no longer visible.
> When you "change" botin, you are trying to change the function parameter,
> which is not possible (no workaround either).
>
> You should use the full path when trying to change botin:
>
> scala> object a {
>      | var x = 0;
>      | def f(x: Int) = { a.x = x }
>      | }
> defined module a
> scala> a.x
> res18: Int = 0
> scala> a.f(5)
> scala> a.x
> res20: Int = 5
>
> See how I access a's x inside f?
>
> By the way, by changing the a "global" variable from inside a function you
> are doing the worst possible sin known to functional programming. Scala
> allows you to do that, but I advise you to try to change that.
>
>
>
>

So, if i understand correctly (and that's a pretty big if), I should have a
class that has the List as a parameter and a function that allows me to
change it ?  Then if I pass the object as a parameter I can still use the
function to make the changes i want ?  Won't I have the same problem as
before ?

And I'm not sure how to change my code so I can avoid commiting the worst
possible sin in functional programming :(

--
View this message in context: http://www.nabble.com/Reassignment-to-Val-tp24363871p24366622.html
Sent from the Scala - User mailing list archive at Nabble.com.

Parent Message unknown Re: Reassignment to Val

by Naftoli Gugenheim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How would you solve your problem in Java? In Java modifying a parameter doesn't affect the variable passed to the function.
vals are Java's final. In Java I believe it is recommended that function parameters should be final.

-------------------------------------
Joob<travaildereligion@...> wrote:


Java, Actionscript, Ruby
Theyre all object oriented, I guess that's why I have trouble with
functional programing

However Scala has some object oriented features as well as functional so I
thought it wouldn't be too complicated, but anyway...



Naftoli Gugenhem wrote:

>
> What language(s) are you coming from?
>
> -------------------------------------
> Joob<travaildereligion@...> wrote:
>
>
>
>
> Daniel Sobral wrote:
>>
>> If it is a function parameter, then the main's botin is no longer
>> visible.
>> When you "change" botin, you are trying to change the function parameter,
>> which is not possible (no workaround either).
>>
>> You should use the full path when trying to change botin:
>>
>> scala> object a {
>>      | var x = 0;
>>      | def f(x: Int) = { a.x = x }
>>      | }
>> defined module a
>> scala> a.x
>> res18: Int = 0
>> scala> a.f(5)
>> scala> a.x
>> res20: Int = 5
>>
>> See how I access a's x inside f?
>>
>> By the way, by changing the a "global" variable from inside a function
>> you
>> are doing the worst possible sin known to functional programming. Scala
>> allows you to do that, but I advise you to try to change that.
>>
>>
>>
>>
>
> So, if i understand correctly (and that's a pretty big if), I should have
> a
> class that has the List as a parameter and a function that allows me to
> change it ?  Then if I pass the object as a parameter I can still use the
> function to make the changes i want ?  Won't I have the same problem as
> before ?
>
> And I'm not sure how to change my code so I can avoid commiting the worst
> possible sin in functional programming :(
>
> --
> View this message in context:
> http://www.nabble.com/Reassignment-to-Val-tp24363871p24366622.html
> Sent from the Scala - User mailing list archive at Nabble.com.
>
>
>

--
View this message in context: http://www.nabble.com/Reassignment-to-Val-tp24363871p24366689.html
Sent from the Scala - User mailing list archive at Nabble.com.


Re: Reassignment to Val

by Joob :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

oh
so I should simply return the List and store it ?
that does make more sense, come to think of it...


Naftoli Gugenhem wrote:
How would you solve your problem in Java? In Java modifying a parameter doesn't affect the variable passed to the function.
vals are Java's final. In Java I believe it is recommended that function parameters should be final.

-------------------------------------
Joob<travaildereligion@hotmail.com> wrote:


Java, Actionscript, Ruby
Theyre all object oriented, I guess that's why I have trouble with
functional programing

However Scala has some object oriented features as well as functional so I
thought it wouldn't be too complicated, but anyway...



Naftoli Gugenhem wrote:
>
> What language(s) are you coming from?
>
> -------------------------------------
> Joob<travaildereligion@hotmail.com> wrote:
>
>
>
>
> Daniel Sobral wrote:
>>
>> If it is a function parameter, then the main's botin is no longer
>> visible.
>> When you "change" botin, you are trying to change the function parameter,
>> which is not possible (no workaround either).
>>
>> You should use the full path when trying to change botin:
>>
>> scala> object a {
>>      | var x = 0;
>>      | def f(x: Int) = { a.x = x }
>>      | }
>> defined module a
>> scala> a.x
>> res18: Int = 0
>> scala> a.f(5)
>> scala> a.x
>> res20: Int = 5
>>
>> See how I access a's x inside f?
>>
>> By the way, by changing the a "global" variable from inside a function
>> you
>> are doing the worst possible sin known to functional programming. Scala
>> allows you to do that, but I advise you to try to change that.
>>
>>
>>
>>
>
> So, if i understand correctly (and that's a pretty big if), I should have
> a
> class that has the List as a parameter and a function that allows me to
> change it ?  Then if I pass the object as a parameter I can still use the
> function to make the changes i want ?  Won't I have the same problem as
> before ?
>
> And I'm not sure how to change my code so I can avoid commiting the worst
> possible sin in functional programming :(
>
> --
> View this message in context:
> http://www.nabble.com/Reassignment-to-Val-tp24363871p24366622.html
> Sent from the Scala - User mailing list archive at Nabble.com.
>
>
>

--
View this message in context: http://www.nabble.com/Reassignment-to-Val-tp24363871p24366689.html
Sent from the Scala - User mailing list archive at Nabble.com.

Re: Reassignment to Val

by Daniel Sobral :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, if that's possible, yes, that's what you should do.

On Tue, Jul 7, 2009 at 12:59 AM, Joob <travaildereligion@...> wrote:

oh
so I should simply return the List and store it ?
that does make more sense, come to think of it...



Naftoli Gugenhem wrote:
>
> How would you solve your problem in Java? In Java modifying a parameter
> doesn't affect the variable passed to the function.
> vals are Java's final. In Java I believe it is recommended that function
> parameters should be final.
>
> -------------------------------------
> Joob<travaildereligion@...> wrote:
>
>
> Java, Actionscript, Ruby
> Theyre all object oriented, I guess that's why I have trouble with
> functional programing
>
> However Scala has some object oriented features as well as functional so I
> thought it wouldn't be too complicated, but anyway...
>
>
>
> Naftoli Gugenhem wrote:
>>
>> What language(s) are you coming from?
>>
>> -------------------------------------
>> Joob<travaildereligion@...> wrote:
>>
>>
>>
>>
>> Daniel Sobral wrote:
>>>
>>> If it is a function parameter, then the main's botin is no longer
>>> visible.
>>> When you "change" botin, you are trying to change the function
>>> parameter,
>>> which is not possible (no workaround either).
>>>
>>> You should use the full path when trying to change botin:
>>>
>>> scala> object a {
>>>      | var x = 0;
>>>      | def f(x: Int) = { a.x = x }
>>>      | }
>>> defined module a
>>> scala> a.x
>>> res18: Int = 0
>>> scala> a.f(5)
>>> scala> a.x
>>> res20: Int = 5
>>>
>>> See how I access a's x inside f?
>>>
>>> By the way, by changing the a "global" variable from inside a function
>>> you
>>> are doing the worst possible sin known to functional programming. Scala
>>> allows you to do that, but I advise you to try to change that.
>>>
>>>
>>>
>>>
>>
>> So, if i understand correctly (and that's a pretty big if), I should have
>> a
>> class that has the List as a parameter and a function that allows me to
>> change it ?  Then if I pass the object as a parameter I can still use the
>> function to make the changes i want ?  Won't I have the same problem as
>> before ?
>>
>> And I'm not sure how to change my code so I can avoid commiting the worst
>> possible sin in functional programming :(
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Reassignment-to-Val-tp24363871p24366622.html
>> Sent from the Scala - User mailing list archive at Nabble.com.
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Reassignment-to-Val-tp24363871p24366689.html
> Sent from the Scala - User mailing list archive at Nabble.com.
>
>
>

--
View this message in context: http://www.nabble.com/Reassignment-to-Val-tp24363871p24366796.html
Sent from the Scala - User mailing list archive at Nabble.com.




--
Daniel C. Sobral

Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.

Re: Reassignment to Val

by Joob :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

But what if I have my main calling a function calling another function which modifies the list,
or any other scenario where the object wouldn't be directly accessible ?

My application goes through the main only once, then loops in another function that accepts user input to apply various operations to the list, by calling other operation-specific function such as "add entry" "delete entry" etc


Daniel Sobral wrote:
Well, if that's possible, yes, that's what you should do.

On Tue, Jul 7, 2009 at 12:59 AM, Joob <travaildereligion@hotmail.com> wrote:

>
> oh
> so I should simply return the List and store it ?
> that does make more sense, come to think of it...
>
>
>

Parent Message unknown Re: Reassignment to Val

by Naftoli Gugenheim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You always have two choices: either those functions can return relevant information, or they can modify a var that the function and its caller have access to. The first way I believe is more FP, the second more OOP.
By the way scala makes the first easy even when the function has to return multiple values, using tuples or case classes with pattern matching.

-------------------------------------
Joob<travaildereligion@...> wrote:


But what if I have my main calling a function calling another function which
modifies the list,
or any other scenario where the object wouldn't be directly accessible ?

My application goes through the main only once, then loops in another
function that accepts user input to apply various operations to the list, by
calling other operation-specific function such as "add entry" "delete entry"
etc



Daniel Sobral wrote:

>
> Well, if that's possible, yes, that's what you should do.
>
> On Tue, Jul 7, 2009 at 12:59 AM, Joob <travaildereligion@...>
> wrote:
>
>>
>> oh
>> so I should simply return the List and store it ?
>> that does make more sense, come to think of it...
>>
>>
>>
>
>
>

--
View this message in context: http://www.nabble.com/Reassignment-to-Val-tp24363871p24366861.html
Sent from the Scala - User mailing list archive at Nabble.com.


Re: Reassignment to Val

by Daniel Sobral :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You do not need to keep a var with the list. You can just pass the resulting list back and forth, but, at this point, I don't think that can be taught in this list. You need to see a lot of functional code to get the idea.

So, instead, I'll suggest something for which many here will condemn me (seriously!). Put this object somewhere:

object Botin {
  var botin: ... = Nil
}

And then assign the results to Botin.botin. It will fix your immediate problem, but programming this way will bring you many other problems.

On Tue, Jul 7, 2009 at 1:08 AM, Joob <travaildereligion@...> wrote:

But what if I have my main calling a function calling another function which
modifies the list,
or any other scenario where the object wouldn't be directly accessible ?

My application goes through the main only once, then loops in another
function that accepts user input to apply various operations to the list, by
calling other operation-specific function such as "add entry" "delete entry"
etc



Daniel Sobral wrote:
>
> Well, if that's possible, yes, that's what you should do.
>
> On Tue, Jul 7, 2009 at 12:59 AM, Joob <travaildereligion@...>
> wrote:
>
>>
>> oh
>> so I should simply return the List and store it ?
>> that does make more sense, come to think of it...
>>
>>
>>
>
>
>

--
View this message in context: http://www.nabble.com/Reassignment-to-Val-tp24363871p24366861.html
Sent from the Scala - User mailing list archive at Nabble.com.




--
Daniel C. Sobral

Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
< Prev | 1 - 2 | Next >