a multi-dimensional Safearray attempt with dynamic index

Started by Eduardo Jorge, June 12, 2018, 08:34:10 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Eduardo Jorge

MIKE, I do not know exactly what you understood from what I wrote, since even if you restrict, there are terms that have multiple meanings.

and as Charles spoke
  "FreeBasic is Row-Major, like C. PowerBasic is Column-Major."

what is the internal O2 standard?

"Perhaps we do not need language specifications and standards at all?"
of course we need to, but O2 does not yet have an internal standard, so the solutions presented are according to the present need as Charles himself pointed out.

this makes explicit that there is a difference to implement and use, I even had difficulty using some examples posted to read the imported vba array, if it was calculated internally I would simply have to transpose the array,
  •  

Charles Pegge

Apart from representations of pixels in an image, and fields in records, we have OpenGl matrixes, which use column-major storage.

The  column-major and row-major terminology is confusing because there are two aspects to consider:

First, how the data is stored. For pixels the data is row-contiguous, and for matrixes the data is normally column-contiguous.

Second, the order of indexes in the array expression. For pixels, it is normally x then y, in other words, column then row. But this could easily be reversed.

Eduardo Jorge

about language patterns
O2 does not yet have a defined array index and this is clear, O2 is in alpha, and this can be implemented by Chales in the future without affecting what has already been written
then the calculated indexed examples may follow the stated need.

in speaking of Basic patterns, what is the current pattern?
Thin basic for example does not have Goto, something usually standard,
what I found out there in the various Basic
declaration of variables, int x, dim x to integer ...
endif, end if, end
among many other things

porting a small code, "even without an array", may require rewriting everything, even if it is Basic
  •  

Mike Lobanovsky

Eduardo,

I wasn't speaking about the "O2 standard", which I don't even know how to interpret to see what it might relate to. And please, spare me your fantasies about what a BASIC should and shouldn't be. If you have questions to Eros Olmi why he wouldn't implement a goto in his thinBasic dialect, then go ask him why, rather than tell me that someone else should or shouldn't do the same. A programming language is not a subject of the case law but is instead subject to strict standardization and meticulous observance.

I was speaking about standard BASIC that we should stick to until we (hopefully) have a newer base document (standard) that would define the aspects of modern BASIC particularities as thoroughly as the older one did.

And it is not the user's prerogative to decide how the BASIC arrays should behave. On the contrary, it is the BASIC dialect developer's responsibility to implement their language in such a way that it is compliant and thus may be called a BASIC at all. And then, it would be the user's responsibility to apply matrix transpose whenever an array element order different from BASIC's conventional column-major is needed for whatever purpose.

It came as a surprise to me that FreeBASIC uses C-style arrays. Such an overt deviationism can indeed be an inexhaustible source of bugs and confusion for the BASIC'ers that know what a BASIC array or matrix should be.
Mike
(3.6GHz Intel Core i5 w/ 16GB RAM, 2 x GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)
  •  

Eduardo Jorge

Mike, probably the language barrier is not totally broken by a translator.
but the fact is that, I agree with you on a standardization,
the basic is being massacred by other languages precisely because of lack of a standard of the several existing implementations.

O2 was the only one that I was able to adapt in comparison to so many other basic ones that I tested. even the array being primitive
to my view the intention with the O2 Standard was to be a point of support for the various existing basic's, and to show that to program does not have to be with a lot of || ! = {..}, despite accepting the symbology, the programmer who chooses
  •  

Mike Lobanovsky

If I had the honor of being Charles Pegge, I would implement column-major arrays as the language standard facility in the first place. And then, being as creative and generous as he is, I would throw in a couple of his brilliant macros (in a small font somewhere in the help file footnotes) for the sake of those who might need a different array storage order when dealing exclusively with some 3rd party modules and/or applications.

That's what I'd call "justified polymorphism". :)
Mike
(3.6GHz Intel Core i5 w/ 16GB RAM, 2 x GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)
  •  

Eduardo Jorge

I'm not understanding, in case in a given example have to enforce an internal standard that is not followed by all,
I believe that this would only apply to a native embodiment of language
provide (x * lt + y), and have the person use another program to adjust something that a change in the calculation solves, is not consistent
  •  

Mike Lobanovsky

#22
Quoteenforce an internal standard that is not followed by all

It must be followed by all. Otherwise, the BASICs that don't follow it have no right to be called compliant BASICs. They are just indie deviations.

Dartmouth BASIC has column-major arrays. Visual Basic has column-major arrays. PowerBASIC has column-major arrays. What other "flagships" do you need?

Quotehave the person use another program to adjust something that a change in the calculation solves, is not consistent

Matrix transposition is not another program. It is an ordinary matrix mathematics operation standardized by the Dartmouth BASIC specification.

There are many practical cases when BASIC has to communicate with modules (DLLs) written in other languages, and sometimes vice versa. The other languages (like C and its derivatives) have a different array storage order (row-major). Before dealing with two-dimensional arrays that are "calculated" and/or filled in by libraries written in C/C++/C# etc., BASIC is supposed to transpose them to be able to use the same indices that the original C/C++/C# etc. library code was using when filling in those arrays.

This is just one of the base differences between different languages, just like {} and Begin/End. You have to remember it, live with it, cope with it, and follow it if you want to be a successful programmer.
Mike
(3.6GHz Intel Core i5 w/ 16GB RAM, 2 x GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)
  •  

Eduardo Jorge

in my limited knowledge of programming.
I think there are other important points about standardization that need to be solved before you care about a Row-Major, Column-Major pattern that does not even exist in O2,

what basic implementations are compatible with each other, that just copy from one to another and will work "even if arrays do not work"?

when doing communication with other programs the programmer has to be aware of the order of the matrix of both the other and the program he uses, and until that point he will have to deal with and learn much simpler things such as syntax,

when you pass arrays if you have to do the required processing, I already had to do this between vba and postgresql, it is easier to handle this than the syntax differences found in BASICs
  •  

Eduardo Jorge

if speaking of standardization, I remember that the sql of the various databases are not so standardized
  •  

Mike Lobanovsky

Quoteit is easier to handle this than the syntax differences found in BASICs

Then you're probably looking into the wrong BASICs. I said, Dartmouth/VB/PB -- where else should you be looking into?

And finally, if you still have problems/difficulties with the syntax of major BASICs that are still showing some signs of life, then it is probably a little too early for you have your own point of view on what's more and what's less important to an average BASIC programmer, to say nothing of a BASIC dialect developer.

Quotewhat basic implementations are compatible with each other, that just copy from one to another and will work "even if arrays do not work"?

All compliant BASICs should, as a minimum, be able to run Dartmouth code as-is. All more advanced features of the language are just dialect-specific extensions, regretfully, non-standardized up till now.

A good example of compliant BASIC is your hateful Script BASIC that runs the code snippets from the book I quoted earlier without a single change (except for the DATA/READ commands that wouldn't be hard to fix if need be). There are some other dialects that are able to do the same with equal ease.

And if O2 isn't able to read and execute Dartmouth code (directly or with a dedicated, special-purpose include file) as flawlessly, then I am afraid O2 cannot be called a compliant BASIC, regardless of its versatility and polymorphism.
Mike
(3.6GHz Intel Core i5 w/ 16GB RAM, 2 x GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)
  •  

Eduardo Jorge

#26
are they really portable codes with each other?
I think in PB I had problems with the Base of the arrays, and something else, and how it was paid, I did not even go ahead.

Do you speak of Dartmouth, but what about developments coming with the advancement of technology?
would not these be standardized among the various basic's?
or at least be easily included?

I think the main thing is not to maintain an absolute compatibility with the past,
is to exchange possibilities and facilities focusing on the context.
"All more advanced features of the language are just dialect-specific extensions, regretfully, non-standardized up till now."

and of course if you can keep the backward compatibility even better, even though there are few instructions.


but well, that would be solved if it had a centralized decision-making,
  so it will continue like this, each one deciding what is most important in the compiler or interpreter that creates
  •  

Anthon Com

Eduardo, you are right.

There is little need to have a full compatibility with previous or dinosaurean basic. As long as
it can do the job like OxygenBasic, it should be worth its salt. Going backwards to those
Jurassic era Basic is pure stupidity just like SB does.
  •  

Eduardo Jorge

Charles, I apologize
by my mistake, the initial tests with arrays and macros presented an unrealistic processing time.
but I saw that I was wrong, and that even just with the instructions of the loops takes longer than that.
I tested it in C and it takes more than 2 minutes, "I do not know what led this colleague to say that in Delphi it took 50 seconds", another one with the PB took 5 minutes, but they are different machines.

I'll look at the examples you have in O2 threads, and see if have how to split the processes in my project,
I have many analyzes that are independent,
and I'm also going to try to switch to 64bit
  •  

Eduardo Jorge

#29
Quote from: Anthon Com on June 19, 2018, 02:31:09 PM
Eduardo, you are right.

There is little need to have a full compatibility with previous or dinosaurean basic. As long as
it can do the job like OxygenBasic, it should be worth its salt. Going backwards to those
Jurassic era Basic is pure stupidity just like SB does.

yes, who will want to use Let, Rem, (Goto "line number")

if they do not even decide the basic syntax
( "end if", "endif", "end" ),
(base 0, base1, escolha base),
("function=x", "return x", "function name=x"), 
( $ for string),
("&", "+" to concatenate) ...
existence of basic functions such as Goto, Gosub


the fact is that each one chooses what to do in his compiler or translator and they are not of portable codes
Who's going to be involved if it's Row-Major, Column-Major do you have to re-enter the code?

if it's Row-Major or Column-Major, internal, it's only important if you have to make way for other applications, and I think anyone will prefer to imbibe a transpose than to rewrite all the code
  •