octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #47687] automatic broadcasting for assignment


From: Lachlan Andrew
Subject: [Octave-bug-tracker] [bug #47687] automatic broadcasting for assignment operations
Date: Wed, 13 Apr 2016 21:57:26 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #1, bug #47687 (project octave):

Why would this be nice?

It is easy to use repmat for this situation.

As I have previously pointed out, automatic broadcasting masks many
programming errors making debugging harder.  Remember that the size of  a  may
have been set in an entirely different function.  If you saw the line


a(:,:) = b;


in isolation, you would have no way of knowing whether or not broadcasting had
been applied, or to what dimension.  If you expected  b  to be a scalar, it
would be nice for the system to warn you that it wasn't -- but we can't
because we can't set warnings for automatic broadcast.

Also notice that in all other cases, automatic broadcasting is symmetric in
the dimensions of the two arguments.  Would you expect


a(1, 1:2) = eye (2);


to give you a 1x2 or 2x2 result, or an error?

In our last discussion, you said that there should be no warning for automatic
broadcasting because "it is part of the language".  If it is spreading further
and further, then I'm tempted to compare it to a cancerous part of the
language.

Unless there is a clear instance when this is useful, I will argue strongly
against it.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47687>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]