I'm finally getting around to working on the Show module, and I'd like
to have one instance cover most of the basic types, like this:
instance[t in basic_types] Show[t] {
fun str: t -> string = "flx::rtl::strutil::str<#1>($1)" requires
flx_strutil;
}
However, we need to provide some overrides for tiny and utiny so they
aren't printed out as chars:
instance Show[tiny] {
fun str: tiny -> string = "flx::rtl::strutil::str<int>($1)" requires
flx_strutil;
}
instance Show[utiny] {
fun str: utiny -> string = "flx::rtl::strutil::str<unsigned int>($1)"
requires flx_strutil;
}
But we can't do this directly because we're providing two instance of
Show for tiny and utiny. So, rather than having to do this:
instance[t in typesetof(short,ushort,int,uint,...)] Show[t] { ... }
I'd prefer to do this:
instance[t in basic_types - typesetof(tiny,utiny)] Show[t] { ... }
But this doesn't work for me. Did I miss how to do this, or does it need
to be implemented?
Also, think it'd be doable to have "open Show[basic_types]" instead of
having to list out each type?
And just to repeat myself from the last time we talked about this, I'd
still like to be able to do "open instance Show[int]", even if it isn't
quite conceptually sound. I'd just make the code a bit easier to read :)
-e
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language