[Gambas-user] something need to be done with the compiler

Benoît Minisini gambas at ...1...
Wed Jul 8 12:29:14 CEST 2009


> Benoît Minisini ha scritto:
> >> Benoît Minisini wrote:
> >>>> I have been trying learn gambas for a month  now , I quite happy with
> >>>> it other than the compiler .
> >>>> the compiler just too stupid . when I code a program and some time
> >>>> typo or
> >>>> forget the fill a parameter of a function , the compiler just ignore
> >>>> it .
> >>>>
> >>>> I spend more time to trace such stupid problem on run time  . try to
> >>>> image
> >>>> you get weird exception from your program and the problem is some typo
> >>>> you
> >>>> made or made by others. the program you made will be full of unknown
> >>>> bugs that not yet discover
> >>>>
> >>>> this is really giving huge problem for anyone want to use gambas to
> >>>> develop
> >>>> a program .
> >>>>
> >>>> the compiler should check all these problem and show warning as what a
> >>>> normal compiler should do.
> >>>
> >>> The compiler could warn only when calling a function in the same class.
> >>> I may
> >>> add that check.
> >>>
> >>> But, as I explained before, it cannot do anything for call between two
> >>> different classes.
> >>>
> >>> But when you enter a function call, the IDE shows you the syntax of the
> >>> function in a tooltip, so I don't understand how you could forget an
> >>> argument
> >>> too often.
> >>>
> >>> Regards,
> >>>
> >>> --
> >>> Benoît
> >>>
> >>> -----------------------------------------------------------------------
> >>>-- ----- Enter the BlackBerry Developer Challenge
> >>> This is your chance to win up to $100,000 in prizes! For a limited
> >>> time, vendors submitting new applications to BlackBerry App World(TM)
> >>> will have the opportunity to enter the BlackBerry Developer Challenge.
> >>> See full prize
> >>> details at: http://p.sf.net/sfu/Challenge
> >>> _______________________________________________
> >>> Gambas-user mailing list
> >>> Gambas-user at lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>
> >> checking the whole project will be the best . if those unable to find
> >> show as warning not error . even if slow down , I doubt anyone will mind
> >> .
> >>
> >> I'm a lazy programmer .  sometime I change the parameter of a function
> >> in a class or module , sometime I remove or move some share variable or
> >> function .
> >>
> >> I usually left the checking to the compiler (as most programming
> >> language compiler will do)  . the compiler will tell me where in the
> >> code that is effected to the change .
> >>
> >> gambas compile is the first compiler that I encounter that doesn't do
> >> what a standard compiler must do.
> >>
> >> i think this limitation is very bad to gambas . for example if you
> >> distribute some component . then at some version some function is remove
> >> . the people that using the component won't be able to know cause the
> >> compiler doesn't give them any warning .
> >
> > What you see as a disadventage is exactly what I didn't find in other
> > languages. I wanted a full dynamic linking and a very fast compiler. This
> > is the reason why the compiler cannot check anything outside of the class
> > it compiles.
> >
> > And if the interface of a component changes, you must change its version
> > number. Of course Gambas does not force you to do so, but this is a
> > common practice.
> >
> > As I said before, I can add the only possible check: inside the same
> > class.
> >
> > But as the linking is entirely dynamic, only the interpreter, during
> > execution, and the first time it calls the method, can know if the
> > arguments of the caller and the called method match. Checking argument
> > matching cannot be 100% reliable at compile time.
> >
> > I understand that it is disturbing for you and other people, but it is
> > mainly a matter of habits. I don't want at the moment to break what I
> > done to implement this kind of check in Gambas 3. It may be something for
> > Gambas 4.
> >
> > Regards,
>
> Sorry for breaking in,
>
> I've read this thread and I must say that you both are right, 'til this
> point. But there is a thing I don't understand: if the IDE knows the
> footprint of all the procedures of all the classes, and in fact the IDE
> guides the user while he is writing, could'nt it be feasible to add a
> menu item to check for inconsistencies of this kind? One could invoke
> this function only when needed, so the two kinds of users could have
> what they want: people like me and Kobolds would have a solid check,
> others could have this light-fast compiler...
>
> I can understand that it is a hard work, but it could be important.
>
> Regards,

The IDE is not a compiler. It only shows the function syntax, and as I 
explained above, it is sometimes not reliable on that because of the linking 
being fully dynamical.

In other words, there is a lot of code in the IDE to load component 
description files, analyze all the global symbols declared in a source file, 
and the local ones. This is done on demand, in the context of the function 
where the cursor is, and it takes a lot of time.

To check all function calls, the compiler would have to do the same thing, in 
C. It will slow him a lot, because it would have to do the same job for each 
function call, whereas the IDE has to do it only when you are typing it. And 
it will not be 100% reliable.

Regards,

-- 
Benoît




More information about the User mailing list