google-code-export / gambas

Automatically exported from code.google.com/p/gambas
1 stars 0 forks source link

Missing error message with 2D arrays #336

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1) Describe the problem.

Missing error message when passing boolean array instead of integer array.

2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: TRUNK
Revision: r5219 
Operating system: Linux
Distribution: Xubuntu 
Architecture: x86_64
GUI component: GTK+
Desktop used: XFCE

3) Provide a little project that reproduces the bug or the crash.

Attached.

5) Explain clearly how to reproduce the bug or the crash.

Run the attached project and observe changed array bounds.

Original issue reported on code.google.com by jussi.la...@gmail.com on 4 Oct 2012 at 5:14

Attachments:

GoogleCodeExporter commented 9 years ago
Arrays are automatically converted from one type to another type. 

But the conversion function always convert the source array to a 
one-dimensional array.

Do you think that:

- It should be an error?

- Or the conversion must be done but the number of dimensions preserved?

Original comment by benoit.m...@gmail.com on 12 Oct 2012 at 5:13

GoogleCodeExporter commented 9 years ago
If the conversion is done, then it should be complete.
IE, dimensions should be preserved.

But I think passing array of different type is usually done by accident..?
So if it is allowed it should also yield warning, but is that possible?

Original comment by jussi.la...@gmail.com on 12 Oct 2012 at 5:23

GoogleCodeExporter commented 9 years ago
Not really, as the compiler does not always know the datatype of expressions at 
compile time.

I prefer to keep the implicit conversion, because this is the BASIC way of 
doing things, and it normally brings more easiness than problems.

Original comment by benoit.m...@gmail.com on 12 Oct 2012 at 5:31

GoogleCodeExporter commented 9 years ago
Fixed in revision #5237.

The array conversion now correctly preserves the dimensions.

Original comment by benoit.m...@gmail.com on 14 Oct 2012 at 10:53