[Gambas-user] Correct strategy for VB static var conversion to Gambas?

John Anderson johna at starflightinc.com
Mon May 31 01:49:55 CEST 2021


- if you agree that all the changes that will be part of Gambas are free 
software of course.

-Not a problem.
>
> Now I answer your point, but don't hesitate to write a more detailed 
> requirement specifications so that I can give you a delay.
>
>>
>> 1. Support "static" var.  Gamabas already let's you Dim a var inside 
>> a function, a Static seems reasonable.  You don't have to use it if 
>> you don't want to.
>
> As I told in a previous mail, it's possible to implement, except that 
> "static" becomes ambiguous inside a class method (you will say that 
> you don't care, but I have to).
>
>>
>> 2.  Support "End Function, End Sub" etc without complaining.
>
> Does it complain? I thought you can use 'End Function' or 'End Sub' 
> instead of 'End' indifferently.
>
>> Gambas can also know that "Type" is a "Struct" and so on.  Those are 
>> minor little things I know.  Just saving some steps will not hurt 
>> anything.
>
> If you understand how to use Highlight.Analyze(), it's rather simple 
> to do all the substitutions.
>
>>
>> 3.  "Double" is 8 bytes in VB and C world, it would seem a small 
>> thing to have Gambas know that a "Double" is same as "gb.Float" type 
>> also. It's confusing reading Gambas code because in C world a "Float" 
>> is 4 bytes - which we never ever use anyway, and we never once used a 
>> VB Single.
>
> Same remark.
>
>>
>> 4.  With this gb.VBConversion, arrays could be delimited with "()" 
>> instead of just "[]".  Why not make life easier for VB folks to get 
>> drawn into Gambas World.
>
> I'm afraid it's not possible. "()" is already an operator in Gambas, 
> used for function calls.
>
> An automatic translator may do the substitution, but it's a complex 
> task to make the difference between array access and function access. 
> I don't even know how VB managed that, but I guess it's just one 
> horror amongs many others.
>
>>
>> 5.  If possible, some way to define local or static arrays inside a 
>> function.  Again, mybe not pretty, but it's what I have to work with 
>> on a conversion - in many hundreds of functions.
>
> As soon as you don't use embedded arrays. They cannot be local. But 
> they can be static (as static = module/class global).
>
> Regards,
>
Thanks very much!!  You and everyone else have given me more stuff to 
think on. Let me look at HIghlight.Analyze / gb.eval etc and play with 
that for a bit.  That would be cool if Gamabs could convert it's own 
source code....

I THINK the main stumbling block now would be a "Static" type in a 
function.  Having that I THINK having that feature would make the 
conversion process  much quicker and more error resistant, and it would 
save needing lots of module files.

And I know know other Gambas users here probably won't need a Static in 
a function too much, and I'm more than willing to pay for my "sins" 
against pretty code. <Grin>

Let my try a few things first and I'll get back to you on private email 
Benoît.

-John






More information about the User mailing list