logo       

Re: Patch review - Multi-dimensional arrays: msg#00042

lang.boo.devel

Subject: Re: Patch review - Multi-dimensional arrays

On Sat, 19 Feb 2005 22:37:53 -0600, Doug H
<doug00-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> On Fri, 18 Feb 2005 14:14:45 -0500 (EST),
> jira-yCVjj/EcxBJg9hUCZPvPmw@xxxxxxxxxxxxxxxx
> <jira-yCVjj/EcxBJg9hUCZPvPmw@xxxxxxxxxxxxxxxx> wrote:
> > O-K, I just noticed this issue. Is there a functional problem with these
> > patches as to why they haven't been applied? Too much integration problems?
>
> ,,,
> Anyway, here's a summary of some of the patches out there
> ....
> Multi-dimensional arrays
> http://jira.codehaus.org/browse/BOO-173
> I contacted Peter about updating his patch. I'll look at it too. I
> think we decided on a "matrix" builtin function for creating
> multidimensional arrays. I don't know if we decided on (int,3)
> (int*3) or (int^3). The patch says that it uses (int,3).
>

We were talking about this one in the irc channel just yesterday.

There are lots of changes in there so I think it would make things
easier if we could apply partial patches to implement in this order:

==============================================================
1. multidimensional array indexing
--------------------------------------------
First thing is enabling boo to consume md arrays.

For the test case we would just add a new c# class to
BooCompiler.Tests/SupportingClasses.cs that would expose some md array
returning methods.

The boo side of the test cases would go into testcases/integration as
usual: md-arrays-1.boo .. md-arrays-n.boo.

Implementing this would involve:
1) enabling an internal representation of md array types;
2) adding the necessary transformations to
Steps/ResolveExpressions.cs, for instance:

print a[1, 2]

would become:

print cast(int, a.GetValue((1, 2)))

assuming of course that a is a md array of ints.

2. md array type notation
--------------------------------
Make the parser aware of the chosen notation for md array types.

Add integration tests to make sure the notation can be used wherever a
type reference is expected: field, property and variable declarations,
method parameters and return types, typeof and cast expressions.

3. matrix builtin
-------------------
Provide a simple way to create and hopefully initialize md arrays.

4. extend the md indexing syntax to indexed properties
----------------------------------------------------------------------
class MultiplicationTable:
Item(i as int, j as int):
get:
return i*j

m = MultiplicationTable()
print m.Item[1, 2]
print m.Item[2, 1]


and

[DefaultMember("Item")]
class MultiplicationTable:
Item(i as int, j as int):
get:
return i*j

m = MultiplicationTable()
print m[1, 2]
print m[2, 1]

4. md array complex slicing
------------------------------------
Enable things like a[1:2:1, 3:4], a[:,:], etc.
==============================================================

Each patch could be sent and reviewed in dev (instead of adding them
to the corresponding jira issue) and then upon approval applied by
anyone with commit privileges to the repository.

Thoughts?

Rodrigo



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise