Alef

Star-Dust

Expert
Licensed User
Longtime User
Today browsing a little haphazardly on the web, but throwing an eye to operating systems, I came across Plan 9, an old operating system derived from Unix and updated until a few years ago, I think now abandoned. Operating system that runs on different platforms.

Related to this o.s. we speak of Alef a native language developed to be able to be compiled and run on whatever platform the operating system was.

What I noticed that struck me ... you see a piece of code and square how are passed and returned parameters .... multiple .... something that does not exist in modern languages (you can get creating a custom type ... but here it is not necessary)

B4X:
(int, byte*, byte)
func()
{
    return (10, "hello", ’c’);
}

void
main()
{
    int a;
    byte* str;
    byte c;
    (a, str, c) = func();
}

note that the name is not "ALFA" the first letter of the Greek alphabet but "ALEF" that if I'm not mistaken the first letter of the Hebrew alphabet ()
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
if I'm not mistaken the first letter of the Hebrew alphabet ()
That's true.

What I noticed that struck me ... you see a piece of code and square how are passed and returned parameters .... multiple .... something that does not exist in modern languages (you can get creating a custom type ... but here it is not necessary)
It is sometimes named a tuple.

BTW, it is not so distant from:
B4X:
Sub Func As Object()
 Return Array(10, "hello", "c")
End Sub

Dim res() As Object = Func
Dim a As Int = res(0)
Dim b As String = res(1)
Dim c As String = res(2)
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
I would like to have it on B4X
 

Star-Dust

Expert
Licensed User
Longtime User
If only we had some sort of way here in the forum to express such a wish. ;-)
Express a desire and an account, see it realized and another.;)
The forum is full of expressed wishes:p

@Erel suggested a method to achieve something similar
The same method we use with CallSub when the parameters are many, we put an array of objects.

But as it would be nice to have the native tuple in b4X.
 
Top