[OpenSCAD] Getting more information

A. Craig West acraigwest at gmail.com
Thu Jul 4 14:11:28 EDT 2019


I'm sure I used to get the same warning with for (i = v) as well, but I can
no longer replicate that behaviour (even in 2015.03)

On Thu, 4 Jul 2019, 14:07 adrianv, <avm4 at cornell.edu> wrote:

> The warning is new in a recent version of the code.  But the code behavior
> is
> the same.  If v=[] and you write for(i=[0:len(v)-1]) then the loop will go
> over -1 and 0.
>
>
> acwest wrote
> > I think I based my answer on an older version of the code, the case I had
> > in mind works properly now.
> >
> > On Thu, 4 Jul 2019, 13:41 adrianv, <
>
> > avm4@
>
> > > wrote:
> >
> >> acwest wrote
> >> > On Thu, 4 Jul 2019, 10:28 Dan Shriver, <
> >>
> >> > tabbydan@
> >>
> >> > > wrote:
> >> >
> >> >> Likewise, I sometimes get this warning:
> >> >>
> >> >>
> >> >> DEPRECATED: Using ranges of the form [begin:end] with begin value
> >> greater
> >> >> than the end value is deprecated.
> >> >>
> >> >>
> >> >> But I can't see any loop where the starting value is bigger than the
> >> end
> >> >> value.
> >> >>
> >> >
> >> > I mostly get this message when I do a for over an empty array. I
> >> consider
> >> > this behaviour to be a bug, really
> >>
> >> To loop over an empty array you want to write for(i=[0:-1]) and because
> >> of
> >> how ranges work, this range is the same as [-1:0], so it will give you
> -1
> >> and 0.  I'm not sure how anybody thought it could ever be desirable for
> a
> >> range [a:b] to be interpreted as [b:a], but that's the situation.  My
> >> understanding is that the warning is a preliminary step to changing the
> >> behavior.
> >>
> >> But if you just always write [a:1:b] then everything will work the way
> it
> >> should.  The loop for(i=[0:1:-1]) will correctly loop over an empty
> >> array,
> >> giving no loop steps.
> >>
> >>
> >>
> >> --
> >> Sent from: http://forum.openscad.org/
> >>
> >> _______________________________________________
> >> OpenSCAD mailing list
> >>
>
> > Discuss at .openscad
>
> >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> >>
> >
> > _______________________________________________
> > OpenSCAD mailing list
>
> > Discuss at .openscad
>
> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190704/2bc06220/attachment.html>


More information about the Discuss mailing list