[Monetdb-developers] Simple bat operations

Stefan Manegold Stefan.Manegold at cwi.nl
Fri Oct 12 15:39:47 CEST 2007


On Thu, Oct 11, 2007 at 06:02:12PM +0200, Martin Kersten wrote:
> > On 11-10-2007 17:45:46 +0200, darabi at web.de wrote:
[...]
> >> However, I have found one solution to my problem; if I type the left 
> >> hand side, everything works:
> >>
> >> mal>b:bat[:int,:int] := bbp.bind("test");
> >>     
> yes that is necessary. In general the type of the bind can not be known.
> and MAL requires strongly typed instructions.

========
user at host$ mclient -d demo -l mal
mal>b:= bbp.bind("test");
mal>io.print(b);
MAPI  = monetdb at 127.0.0.1:50001
QUERY = io.print(b);
ERROR = !TypeException:user.main[1]:'b' may not be used before being initialized
========

A more informative error mesage might help --- from a user's point of view,
variable 'b' has been initialized before it is used.

In fact, the above
	b:bat[:int,:int] := bbp.bind("test");
is wrong --- or at least implies a silent cast from :oid to :int of the
BAT's head --- since bind returns a bat[:oid,:any_1], i.e., only the tail
type is "unknown" or "generic".

Moreover, what's the actual problem with the io.print, here?

With the bbp.bind(), b get's bound to type :bat[:oid,:any], and pattern
io.print(val:bat[:any_1,:any_2]):void is supposed to accept generic BATs
with arbitrary head & tail types, right?

"Strict" typing should (IMHO) either (1) warn already with the bbp.bind
call, respectively its assignment to b, that b's tail is not fully
specified, and hence should be specified explicitly, or (2) the error with
io.print() should give some typing releated error message instead of
complaining about a non-initialized variable that (froma user's point of
view) has been initialized.

Just my humble suggestions ...

Stefan

> --enable-optimize does not play a role in this process.
> >> mal>io.print(b);
> >> #-----------------#
> >> # h     t         # name
> >> # int   int       # type
> >> #-----------------#
> >>
> >> I will recompile without --enable-optimise.
> >>     
> >
> > Try --enable-debug to make sure you aren't bitten by an insane default of
> > --enable-optimise=yes.
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems?  Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Monetdb-developers mailing list
> > Monetdb-developers at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/monetdb-developers
> >   
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Monetdb-developers mailing list
> Monetdb-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-developers

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |




More information about the developers-list mailing list