[Monetdb-developers] bat.new undefined
Hello, I am trying to make a small function for creating some persistent bats. Could you point me to my (probably stupid) error? Many thanks Kambiz $ mclient --language=mal -d demo mal> mal>function init_schema():void; mal> mal> bbp.bind("schema_version"); mal> mal> # create schema, if it doesn't exist mal> catch MALException:str; mal> mal> s := bat.new(:void,:oid); mal> bat.setName(s, "schema"); mal> bat.setPersistent(s); mal> mal> s := bat.new(:void,:void); mal> bat.setName(s, "version"); mal> bat.setPersistent(s); mal> mal> sv := bat.new(:oid,:int); mal> bat.setName(sv, "schema_version"); mal> bat.setPersistent(sv); mal> mal> cl := bat.new(:oid,:oid); mal> bat.setName(sv, "schema_class"); mal> bat.setPersistent(sv); mal> mal># etc. etc. etc. mal> mal> transaction.commit(); mal> mal> exit; MAPI = monetdb@localhost:50000 QUERY = exit; ERROR = !TypeException:user.init_schema[7]:'bat.new' undefined in: s:bat[:void,:oid] := bat.new(_6:void, _6:void) mal> MAPI = monetdb@localhost:50000 QUERY = ERROR = !TypeException:user.init_schema[7]:'bat.new' undefined in: s:bat[:void,:oid] := bat.new(_6:void, _6:void) !SyntaxException:user.init_schema[18]:begin 'MALException' without exit in init_schema[19] mal> io.print("Schema tables seem to exist. Will do nothing\n"); MAPI = monetdb@localhost:50000 QUERY = io.print("Schema tables seem to exist. Will do nothing\n"); ERROR = !TypeException:user.init_schema[7]:'bat.new' undefined in: s:bat[:void,:oid] := bat.new(_6:void, _6:void) !SyntaxException:user.init_schema[19]:begin 'MALException' without exit in init_schema[20] mal>end init_schema; MAPI = monetdb@localhost:50000 QUERY = end init_schema; ERROR = !TypeException:user.init_schema[7]:'bat.new' undefined in: s:bat[:void,:oid] := bat.new(_6:void, _6:void) !SyntaxException:user.init_schema[18]:begin 'MALException' without exit in init_schema[19] mal>
On 14-11-2007 22:46:34 +0100, darabi@web.de wrote:
mal> # create schema, if it doesn't exist mal> catch MALException:str; mal> mal> s := bat.new(:void,:oid); mal> bat.setName(s, "schema"); mal> bat.setPersistent(s); mal> mal> s := bat.new(:void,:void);
The error occurs here. This is a typing issue, but the expert has to give his opinion on it to make it final. ;) You can try (haven't tested it) to first set it to nil, e.g.: s := nil;
Fabian Groffen wrote:
On 14-11-2007 22:46:34 +0100, darabi@web.de wrote:
mal> # create schema, if it doesn't exist mal> catch MALException:str; mal> mal> s := bat.new(:void,:oid); mal> bat.setName(s, "schema"); mal> bat.setPersistent(s); mal> mal> s := bat.new(:void,:void);
The error occurs here. This is a typing issue, but the expert has to give his opinion on it to make it final. ;)
You can try (haven't tested it) to first set it to nil, e.g.: s := nil;
there he is:-) In MAL arguments and signatures are strongly typed. s:bat[:void,:oid] := bat.new(_6:void, _6:void) is type incompatible. it should have been s:bat[:void,:oid] := bat.new(_6:void, _7:oid)
------------------------------------------------------------------------- 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-developers
On 14-11-2007 22:56:27 +0100, Martin Kersten wrote:
Fabian Groffen wrote:
On 14-11-2007 22:46:34 +0100, darabi@web.de wrote:
mal> # create schema, if it doesn't exist mal> catch MALException:str; mal> mal> s := bat.new(:void,:oid); mal> bat.setName(s, "schema"); mal> bat.setPersistent(s); mal> mal> s := bat.new(:void,:void);
The error occurs here. This is a typing issue, but the expert has to give his opinion on it to make it final. ;)
You can try (haven't tested it) to first set it to nil, e.g.: s := nil;
there he is:-)
In MAL arguments and signatures are strongly typed.
s:bat[:void,:oid] := bat.new(_6:void, _6:void)
is type incompatible. it should have been
s:bat[:void,:oid] := bat.new(_6:void, _7:oid)
The observation is that you cannot reuse variables, unless you want to reuse them for something which has exactly the same type. The assignment makes that counter intuitive, because it /does/ work when the variable has never been referenced before.
Fabian Groffen wrote:
On 14-11-2007 22:56:27 +0100, Martin Kersten wrote:
Fabian Groffen wrote:
On 14-11-2007 22:46:34 +0100, darabi@web.de wrote:
mal> # create schema, if it doesn't exist mal> catch MALException:str; mal> mal> s := bat.new(:void,:oid); mal> bat.setName(s, "schema"); mal> bat.setPersistent(s); mal> mal> s := bat.new(:void,:void);
The error occurs here. This is a typing issue, but the expert has to give his opinion on it to make it final. ;)
You can try (haven't tested it) to first set it to nil, e.g.: s := nil;
there he is:-)
In MAL arguments and signatures are strongly typed.
s:bat[:void,:oid] := bat.new(_6:void, _6:void)
is type incompatible. it should have been
s:bat[:void,:oid] := bat.new(_6:void, _7:oid)
The observation is that you cannot reuse variables, unless you want to reuse them for something which has exactly the same type. The assignment makes that counter intuitive, because it /does/ work when the variable has never been referenced before.
The orginal example showed that the variable was already declared, i.e. type was frozen. mal> s := bat.new(:void,:oid); mal> bat.setName(s, "schema"); mal> bat.setPersistent(s); mal> mal> s := bat.new(:void,:void); mal> bat.setName(s, "version"); mal> bat.setPersistent(s); mal>
------------------------------------------------------------------------- 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-developers
On 15-11-2007 09:55:33 +0100, Martin Kersten wrote:
The observation is that you cannot reuse variables, unless you want to reuse them for something which has exactly the same type. The assignment makes that counter intuitive, because it /does/ work when the variable has never been referenced before.
The orginal example showed that the variable was already declared, i.e. type was frozen. mal> s := bat.new(:void,:oid); mal> bat.setName(s, "schema"); mal> bat.setPersistent(s); mal> mal> s := bat.new(:void,:void); mal> bat.setName(s, "version"); mal> bat.setPersistent(s);
Which is my point. The first assignment to s succeeds, while the type must mismatch, because it is still unknown, while the second assignment fails. I would expect either this: declare s[:void,:oid]; s := bat.new(:void,:oid) or both assignments to succeed.
participants (3)
-
darabi@web.de
-
Fabian Groffen
-
Martin Kersten