Bugs item #2059378, was opened at 2008-08-19 11:55
Message generated for change (Comment added) made by stmane
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2059378&group_id=56967
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core
Group: MonetDB5 CVS Head
Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Fabian (mr-meltdown)
Assigned to: Martin Kersten (mlkersten)
Summary: M5: getTypeIndex && getTypeName misaligned?
Initial Comment:
b := bat.new(:str, :int);
t := inspect.getTypeIndex(b);
io.print(t);
s := inspect.getTypeName(t);
io.print(s);
returns:
[ 6 ]
[ "int" ]
(or is it that getTypeIndex doesn't work well on BATs?)
----------------------------------------------------------------------
>Comment By: Stefan Manegold (stmane)
Date: 2008-08-20 12:38
Message:
Logged In: YES
user_id=572415
Originator: NO
Martin,
was it your intention with your latest code changes that
inspect.getTypeIndex(v:any_1):int still returns the v's tail type in case v
if of type BAT?
What is the intention/reason for this behaviour?
Why can't inspect.getTypeIndex(v:any_1):int for v:BAT simply return "5",
i.e., the index of type "BAT"?
For me, this would be the most simple, intuitive and consistent semantic
of inspect.getTypeIndex(v:any_1):int, definitely since the addition of
inspect.getTypeIndex(v:bat[:any_1,:any_2]) (ht:int,tt:int) (and the fact
that MAL does signature matching on both arguments and return type) ...
========
>b:=bat.new(:oid,:dbl);
>i:=inspect.getTypeIndex(b);
>(h,t):=inspect.getTypeIndex(b);
>io.print(i);
[ 11 ]
>io.print(h);
[ 7 ]
>io.print(t);
[ 11 ]
>x:=inspect.getTypeName(i);
>io.print(x);
[ "dbl" ]
>x:=inspect.getTypeName(h);
>io.print(x);
[ "oid" ]
>x:=inspect.getTypeName(t);
>io.print(x);
[ "dbl" ]
========
>x:=inspect.getTypeName(5);
>io.print(x);
[ "BAT" ]
========
----------------------------------------------------------------------
Comment By: Stefan Manegold (stmane)
Date: 2008-08-20 10:32
Message:
Logged In: YES
user_id=572415
Originator: NO
... and: does inspect.getTypeIndex() work recursively on a BAT who's tail
type is again a BAT ... ?
----------------------------------------------------------------------
Comment By: Stefan Manegold (stmane)
Date: 2008-08-20 10:30
Message:
Logged In: YES
user_id=572415
Originator: NO
The historian recalls that MIL used to have a "type" function that returns
a variable's type, and functions "htype" & "ttype" to request a BATs head-
and tail-type:
MonetDB>var i := 1;
MonetDB>var b := bat(oid,flt);
MonetDB>print(type(i));
[ 6 ]
MonetDB>print(type(b));
[ 5 ]
MonetDB>print(htype(b));
[ 7 ]
MonetDB>print(ttype(b));
[ 10 ]
MonetDB>print(monet_atomtbl.select(type(i)));
#-----------------#
# h t # name
# str int # type
#-----------------#
[ "int", 6 ]
MonetDB>print(monet_atomtbl.select(type(b)));
#-----------------#
# h t # name
# str int # type
#-----------------#
[ "bat", 5 ]
[ "BAT", 5 ]
MonetDB>print(head(b));
[ "oid" ]
MonetDB>print(tail(b));
[ "flt" ]
----------------------------------------------------------------------
Comment By: Fabian (mr-meltdown)
Date: 2008-08-20 10:23
Message:
Logged In: YES
user_id=963970
Originator: YES
Hehe, indeed. At one point I was indeed looking for an "isBAT" function.
----------------------------------------------------------------------
Comment By: Stefan Manegold (stmane)
Date: 2008-08-20 10:15
Message:
Logged In: YES
user_id=572415
Originator: NO
>i:=1:int;
>b:=bat.new(:str, :flt);
>tii:=inspect.getTypeIndex(i);
>tib:=inspect.getTypeIndex(b);
>tni:=inspect.getTypeName(tii);
>tnb:=inspect.getTypeName(tib);
>io.print(tii);
[ 6 ]
>io.print(tib);
[ 10 ]
>io.print(tni);
[ "int" ]
>io.print(tnb);
[ "flt" ]
>manual.help("inspect.getTypeIndex");
inspect.getTypeIndex
>manual.help("getTypeIndex");
inspect.getTypeIndex
>manual.search("getTypeIndex");
pattern inspect.getTypeIndex(v:any_1):int address INSPECTtypeIndex;
#Return the type index of a variable.
So, the implementation of getTypeIndex() does not match its
documentation.
Is there any other function/way in MAL to find out whether a variable is
of an atomic scalar type, or whether it is a BAT?
----------------------------------------------------------------------
Comment By: Martin Kersten (mlkersten)
Date: 2008-08-20 09:58
Message:
Logged In: YES
user_id=490798
Originator: NO
Clarification of semantics. It returns the typeindex of the tail type.
Upon need more will be added, e.g. (ht,tt):= getTypeIndex(b:bat[...
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2059378&group_id=56967
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs