RE: Unusual EU Problem (must see)
- Posted by Al Getz <Xaxo at aol.com> Aug 16, 2003
- 375 views
Pete Lomax wrote: > > > On Thu, 14 Aug 2003 06:39:51 +0000, Al Getz <Xaxo at aol.com> wrote: > > >Very unexpected behavior when i accidentally used: > > > >function FunctionAAA() > > atom param > > param=1 > > return FunctionBBB(param) > >end function > > > <snip> > >procedure FunctionBBB(atom param) > > ?param > >end procedure > > >but no real error comes up as usual in Euphoria. > well, I got Syntax error - expected to see an expression, not a > procedure. If I change FunctionAAA() to a procedure, which is what I > think you meant, there is no error or warning. > > The correct warning to report in this case is unreachable code, or > "will never be executed". > > While I'm here, probably my biggest bugbear: > > The warning system in Euphoria is so OTT that virtually every program > ever written has without warning as the top line, something which > should only be done for release code (possibly if the proposed shroud > -fullsource option is implemented, which creates a single releaseable > source with all the comments etc left intact). A warning system is not > much use if most people turn it off, during development! > > > Firstly, I'd like warnings to be classified, eg: > > unused parameters > unused parameters on routines referenced by routine_id > unused variables > unused constants > unused constants created with side effects > short circuit warnings > unreachable code > > I think that in much the same way you can have with/without trace > covering sections of code, but still need the trace() command, you > need with/without warning and a warning() command, to set the classes > of warnings you are (locally) interested in. > > My code ends up littered with things like: > procedure onClickButton(int self, int event, seq params) > if self or event or length(params) end if -- suppress warnings > > constant menu=create(Menu,"File",0,...) > crud=menu -- suppress warnings > > -- if isVisible(x) or isVisible(y) then > flag=isVisible(x) or isVisible(y) > if flag then > > (And no Rob, you are not allowed to add that extremely annoying > warning to the second case to make them consistent > > > There is definitely something wrong with > without warning > constant A=1 > with warning > having no effect; whether or not you get a warning about A and all > other unused constants depends solely on whether warning is in force > at the end of the file, which is counter-intuitive. Maybe I'm being > simple-minded, but somewhere in the above it must set a flag to > indicate A has never been referenced to True, should be False. > > > Also, if the program dies with an error, it should definitely prompt > before dumping out the warnings and scrolling the error message off > the screen. > > > My other vote would be for a win32 style debugger, with display of > subscripts and slices. > > Pete > Hi Pete, Im for more debug warnings too. (also see my other reply about the strange error). Take care for now, Al