Profile Picture

Add array-indexing to ISeries

Posted By foible 9 Years Ago
Message
Posted Wednesday November 19 2008
The whole Close.LookBack(2) and Close.Current() is verbose and it gets used a lot. It would make code much simpler and clearer if we could just write Close[2] or Close[0]. (Same applies to indicator value lookups.)

Simple change, big help.
Posted Wednesday November 19 2008
Well, at the risk of alienating professional programmers, we went from using the indexer to the Lookback because it was a lot more readable.  We felt it was necessary to nix the indexer because since the order is reversed, you wouldn't get what you were expecting.  What's worse is that it that old systems would compile just fine when we left the indexer in ... that was bad enough for us to remove it entirely, at least for now. 

foible (11/19/2008)
The whole Close.LookBack(2) and Close.Current() is verbose and it gets used a lot. It would make code much simpler and clearer if we could just write Close[2] or Close[0]. (Same applies to indicator value lookups.)

Simple change, big help.
Posted Thursday November 20 2008
Basically we used to use indexers, but Close[0] was the oldest value and Close[Close.Count - 1] was the most recent.  So if we kept using the indexer, old systems would have compiled, but would not have worked correctly.  We felt it was much better to let the compiler find all the places you needed to change.
Posted Thursday November 20 2008
because since the order is reversed, you wouldn't get what you were expecting


The RE developers can control that so Close[0] can be the most recent. It's entirely up to them.


So if we kept using the indexer, old systems would have compiled, but would not have worked correctly. We felt it was much better to let the compiler find all the places you needed to change.

If I understand you, you've tried this before but chose the wrong ordering and so now you prefer to generate compile errors rather than generate incorrect results? I can understand the motivation (when I refactor code, I often do this myself but only as a temporary step). Seeing as how RE is still pushing for version 1.0, some bumps are expected by all early adopters and the decisions you make now will be in place for many years. I think it's shortsighted to sacrifice readability and usability for all future systems in order to preserve backwards compatibility with early beta releases. Your customer base and the number of strategies using your API is only going to grow while the number of strategies using the old indexing scheme are shrinking and may already have nearly vanished.

I urge you to reconsider.


If you're absolutely determined on this point, can you add a shorter, simpler, less verbose alias such as Ago()? Close.Ago(0) is a lot easier on the fingers & eyes than Close.LookBack(0). It may seem small but this is a big workhorse method.
Posted Friday November 21 2008
foible (11/20/2008)
because since the order is reversed, you wouldn't get what you were expecting

If you're absolutely determined on this point, can you add a shorter, simpler, less verbose alias such as Ago()? Close.Ago(0) is a lot easier on the fingers & eyes than Close.LookBack(0). It may seem small but this is a big workhorse method.

Feedback taken, but it does seem like with Intellesense you should not have to type out the entire word.  ".L<tab>" should get you done with two keystrokes.  Or?

Posted Friday November 21 2008
I think we did consider .Ago(), but we felt it wasn't as clear as LookBack and that the difference in length wasn't very important with autocomplete.

RE is not actually pushing for 1.0, we released 1.0 in the summer of 2007.  We've had one edition so far with array indexing disabled, so we might be able to go back in a future edition.  However, that would break existing systems again, unless we left both methods in.  Since the ISeries interface is also for customers to implement if they need, they would have to write two methods that did the same thing.

When we switch to .NET 3.5, you would be able to add en extension method to use Ago() instead of LookBack() if you wanted.  It would also provide us a cleaner migration path back to indexers if we chose to go that route, since we could switch the interface to use indexers and provide a LookBack extension method which would enable most existing code to keep working.

Thanks,
Daniel



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems