[MonoDevelop] Coordinate system refactoring

Alan alan.mcgovern at gmail.com
Mon Jul 19 05:16:13 EDT 2010


Our arrays are 0based so our co-ordinate systems should be zero based :) My
2c is that 0 based systems are much easier for your average joe to use and
easier to debug without thinking about it. If you start using 1 based
systems in a 0 based programming language, bugs will happen.

Alan.

On Mon, Jul 19, 2010 at 9:13 AM, Mike Krüger <mkrueger at novell.com> wrote:

> Hi
>
> I want to refactor the line/column/location refactoring.
>
> What we have now:
>
> A DomLocation in MonoDevelop.Core a DocumentLocation in Mono.TextEditor
> which are exactly the same.
> A 0 based coordinate system in Mono.TextEditor and some other parts in
> the IDE.
> A 1 based coordinate system in the Dom and some other parts of the IDE.
>
> The problem is that 'other parts of the IDE' isn't 100% clear - it has
> even not that many to do which location is used :(
>
> What I want:
>
> To be able to write:
>
> Caret.Location = member.Location.
>
> Instead of:
> Caret.Location = new DocumentLocation (member.Location.Line - 1,
> member.Location.Column - 1);
>
> And no confusion in the coordine systems in 'other parts of the IDE'.
>
> What we need:
> + A reference to Mono.TextEditor from Mono.Core & replacing DomLocation
> with DocumentLocation
> + A decision which coordinate system is used.
>
> Now the question is:
>
> Should we use a 0 based coordinate system or a 1 based ?
>
> My preference would be a 0 based coordinte system for internal
> representation - my wife votes for a 1 based - therefore I need YOUR input.
>
> Sitenote:
> Yes the transition of coordinate systems >may< cause some bugs - but
> currently we already HAVE bugs in the ide because we use different
> coordinate systems and I would prefer not spending any more time to hunt
> bugs caused by +-1 coordinate system annoyances.
>
> /discuss
> Mike
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20100719/82dbe1e8/attachment.html 


More information about the Monodevelop-list mailing list