From: Steve Amphlett on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <hts20o$vt$1(a)fred.mathworks.com>...
> It must be a slow day when a masking variable thread stays in the top 5 for hours on end...

I still think it's a huge problem with the Matlab language. A massive booby-trap sitting there, waiting. A bit like Fortran's implicit declaration of miss-spelled variables or variables truncated by the 72'nd column cut-off.
From: Matt J on
"Steve Amphlett" <Firstname.Lastname(a)Where-I-Work.com> wrote in message <htt5bg$fli$1(a)fred.mathworks.com>...

> I still think it's a huge problem with the Matlab language. A massive booby-trap sitting there, waiting.
=============

I'm actually a bit dumbfounded by how often this occurs. If you're trying to use the same name for two different things (function and variable), I tend to think that you really don't know what's going on in your code.
From: dpb on
Steve Amphlett wrote:
> "Matt Fig" <spamanon(a)yahoo.com> wrote in message
> <hts20o$vt$1(a)fred.mathworks.com>...
>> It must be a slow day when a masking variable thread stays in the top
>> 5 for hours on end...
>
> I still think it's a huge problem with the Matlab language. A massive
> booby-trap sitting there, waiting. A bit like Fortran's implicit
> declaration of miss-spelled variables ...

"IMPLICIT NONE"

> ... or variables truncated by the 72'nd column cut-off.

free-form source format...

:)

--

From: dpb on
Matt J wrote:
> "Steve Amphlett" <Firstname.Lastname(a)Where-I-Work.com> wrote in message
> <htt5bg$fli$1(a)fred.mathworks.com>...
>
>> I still think it's a huge problem with the Matlab language. A massive
>> booby-trap sitting there, waiting.
> =============
>
> I'm actually a bit dumbfounded by how often this occurs. If you're
> trying to use the same name for two different things (function and
> variable), I tend to think that you really don't know what's going on in
> your code.

OTOH, given the size of the ML namespace, in some ways my surprise is it
doesn't happen even more often... :)

"i" and "j" are probably the two most common index variables
ubiquitously used in other code; it's essentially automatic to write
them for anybody who's ever written in any other language at all.

The min() and max() names are, while possibly could claim they always
ought to be minx or miny or somesuch amplified naming convention no
matter what seem perfectly reasonable to use as variable names. And, of
course, if one comes from Fortran (listening, Rune??? :) ) where
function names and variable names are in different name spaces, it's
perfectly permissible (altho I don't recommend it, it makes one not
consider as carefully as otherwise might) in picking names.

One could go on w/ examples... :)

--
From: Matt J on
dpb <none(a)non.net> wrote in message <httojr$f0t$1(a)news.eternal-september.org>...

> > I'm actually a bit dumbfounded by how often this occurs. If you're
> > trying to use the same name for two different things (function and
> > variable), I tend to think that you really don't know what's going on in
> > your code.
>
> OTOH, given the size of the ML namespace, in some ways my surprise is it
> doesn't happen even more often... :)

No, the save of the Matlab namespace is not relevant. It is perfectly harmless to use i, j, min, max, etc... as variable names as long as you don't then try to use them as functions later on in the same workspace.

The problem only occurs when people deliberately try to use the same name for 2 different things in the same mfile.
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9
Prev: Simscape>Mechanical Source
Next: ezplot3 and hold bug?