Well, you can get around assigning x and y globally within a function
with local copula by adding the locale to the name, like x_base_=.1 2
3.

But I don't understand what is meant that periods after x and y mess
up locale assignments.

On Mon, Sep 26, 2011 at 10:51 AM, The Geeko <[email protected]> wrote:
> Raul Miller <rauldmiller@...> writes:
>
>> Have you read the second paragraph here:
>>    http://www.jsoftware.com/help/dictionary/d001.htm
>>
>> or footnote 3, here:
>>    http://jsoftware.com/help/dictionary/d310n.htm
>
> Yes, I have read these passages several times...
>
>>
>> ?
>>
>> My reading of these two concepts suggests that x and y are sometimes
>> prohibited as global names.  And, it's easy enough to conduct an
>> experiment to test this concept:
>
> No.  The way I understand it is that, once you define a name as local using 
> the
> local copula ('=.'), you may not use the global copula ('=:') to assign a 
> value
> to it.  Within a verb's definition, the local copula is automatically provided
> for one or more of {x, y, m, n, u, v} depending on contextual considerations.
>
>>
>>    3 :'y=:0' 0
>> |domain error
>> |   y    =:0
>>
>> So it looks to me as if the implementation matches the dictionary...
> Again, no.  The error in the case you have presented is instructing you that 
> you
> have used incorrect syntax; there is a superfluous 0 at the end of the 
> sentence
> which is outside the script.
>
> But, you are on the right path... if you try to make a global assignment to y
> *from within* your verb definition, you will get an error.  That is stipulated
> in the Dictionary.  When your verb is defined, it is automatically allocated a
> local variable y (and perhaps others as well -- x, m, etc.).  Because of this,
> you may not -- from within the function -- use a global copula to assign a 
> value
> to y.
>
> However, in an interactive session, you may have reason to define a global y.
> Indeed, this is permissible by the language.  And even namelist, a prominent
> verb of the language, correctly reports its existence.
>
>>
>> Yes, originally, the language used x. y. u. v. m. n.
>>
>> However, this caused problems with the syntax for locales.
> Aha!  Thank you for this insight!  I supposed that there was a logical
> explanation.
>
>> Arguably, the fault is in the syntax for locales rather than in those
>> names.  That said, changing how locales work would have been a huge
>> change and may have introduced additional issues.
> Understood.
>
>> So, if we went back to the old way of doing things, and if y. is a
>> reference to an object, how do we access the object?
> I will need to study this area more... but I do know this:  we can still use 
> x.,
> y., m., n., u. and v.  All we need to do is to use the !: foreign conjunction
> (i.e., 9!:49).
>
>
>> Anyways, consistency is only good when it achieves something useful.
>> Language implementations routinely break consistency when the language
>> implementer deems the issue worthy.  Thus, for example, in C, you
>> cannot do:
>>
>>    int default= 0;
>>
> Of course I cannot make that assignment, since *default* is a reserved word in
> C.  Yet, again, I will beg to differ with you on the point of consistency.
> Consistency is always good when it comes to language design/implementation.
> Breaking rules should only be done when necessary.
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to