Roland Bouman wrote:
> Hi Monty, All,
>
>> This brings up what I was chatting about last night, which is pluggable
>> types. And for that matter, types not being totally tied to storage
>> mechanism.
>
> [...]
>
>> But then if I could define a type that was "Static PPM compressed URL"
>> that stores into a BYTES, the yippee! We've got something that defines
>> some behavior and some constraints, and we don't have to have
>> eleventy-billion different basic types - but people _can_ have types
>> that make sense for them.
>>
>> Of course, this means that a pluggable type needs to be able to be done
>> in a sensible way. Defining the types through SQL a-la the standard is
>> retarded. SQL is a query language for crying out loud.
>
> I think this is a very interesting thought and I would love to see
> this feature. Personally I have never looked in detail into the
> standard with regard to user defined types so I cannot comment on how
> retarded that is.
>
> What I am wondering about is how you think about defining (or maybe i
> should say, overloading) operators for user-defined type. I mean, it
> seems to me that specifying values of a certain type (and eventually,
> storing them) is one side of the story. THe other is making stuff like
> +, =, and function calls work. (and I guess as an extra, indexes on
> custom types)
Well... there's a couple of ways (ok, many, many) to go about this.
If the parser treats binary operators simply as syntactic sugar around a
defined call, then it's not that tough - you just have to define the
right methods in your type. So, for instance, if we have:
2 + 2
2 and 2 are both ints, so in theory that could churn down into:
int.add(2,2)
Of course, then there's:
2 + "cow"
Which, if you were crazy enough to think should work in some way, you'd
need a
int add(int, string)
Or something in your type class. This gets in to many of the parts of
operator overloading that people both love and hate.
On the other hand, if user defined types are merely specializations of
basic types (int, real, string, bytes) then
myinttype(12) + myinttype(12)
Should (or would need to) work in as much as adding two ints would work.
and (possibly more importantly)
mystring("foo") == mystring("bar") would operate in the same way as
comparing normal strings. Now, if you store some crazy-ass bytes into a
string, then you just have to sort of be happy with normal string
comparison of those bytes being how it's going to operate.
BTW - this is mostly me thinking out loud, rather than the result of
much careful thought.
> What do you think? Is this something you feel should be part of the
> type definition? If not, how will values of custom types interact with
> expressions that use them?
That's the whole trick. Defining an IP Address type is all well and
good, but what happens when you want to compare them.
OTOH, if you can define both UDFs and UDTs, then you could certainly
write a function to compare objects that you are expecting to be your IP
Address type.
Notice how I haven't mentioned specific implementation here. :)
> kind regards,
>
> Roland.
>
>>> On Oct 10, 2008, at 1:06 AM, Kazuho Oku wrote:
>>>
>>>> Hi,
>>>>
>>>> We run a web service called Pathtraq (http://pathtraq.com/) which is
>>>> one of the largest web access stats service in Japan above MySQL, and
>>>> it relies heavily on varbinary columns.
>>>>
>>>> We are storing tens of millions of URLs in compressed form (using a
>>>> variant of static PPM compression algorithm) in a varbinary column.
>>>> Since PPM compression preserves the order of original text, we can set
>>>> indexes on varbinary columns to do a prefix search on URLs without
>>>> uncompressing them, and it does save a lot of CPU cycles and I/O.
>>>>
>>>> You can find more information on the slides I used at YAPC::Asia Tokyo
>>>> 2008 (around pp.17-27).
>>>> http://www.slideshare.net/kazuho/yapcasia-2008-tokyo-pathtraq-building-a-computationcentric-web-service
>>>>
>>>>
>>>>
>>>> 2008/10/10 Brian Aker <[EMAIL PROTECTED]>:
>>>>> Hi!
>>>>>
>>>>> On Oct 9, 2008, at 6:16 PM, Jim Starkey wrote:
>>>>>
>>>>>> problematic (a useful term, not strictly synonymous with bullshit).
>>>>>
>>>>> That is my take... but I am wondering why it was added. Maybe someone
>>>>> on the
>>>>> list has a use-case I've never thought of.
>>>>>
>>>>> To me binary objects are unstructured data which to me means "blob".
>>>>>
>>>>> Cheers,
>>>>> -Bria
>>>>>
>>>>> --
>>>>> _______________________________________________________
>>>>> Brian "Krow" Aker, brian at tangent.org
>>>>> Seattle, Washington
>>>>> http://krow.net/ <-- Me
>>>>> http://tangent.org/ <-- Software
>>>>> _______________________________________________________
>>>>> You can't grep a dead tree.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~drizzle-discuss
>>>>> Post to : [email protected]
>>>>> Unsubscribe : https://launchpad.net/~drizzle-discuss
>>>>> More help : https://help.launchpad.net/ListHelp
>>>>>
>>>>
>>>>
>>>> --
>>>> Kazuho Oku
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~drizzle-discuss
>>>> Post to : [email protected]
>>>> Unsubscribe : https://launchpad.net/~drizzle-discuss
>>>> More help : https://help.launchpad.net/ListHelp
>>> --
>>> _______________________________________________________
>>> Brian "Krow" Aker, brian at tangent.org
>>> Seattle, Washington
>>> http://krow.net/ <-- Me
>>> http://tangent.org/ <-- Software
>>> _______________________________________________________
>>> You can't grep a dead tree.
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~drizzle-discuss
>>> Post to : [email protected]
>>> Unsubscribe : https://launchpad.net/~drizzle-discuss
>>> More help : https://help.launchpad.net/ListHelp
>>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~drizzle-discuss
>> Post to : [email protected]
>> Unsubscribe : https://launchpad.net/~drizzle-discuss
>> More help : https://help.launchpad.net/ListHelp
>>
>
>
>
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp