null references redux + Looney Tunes
Justin Johansson
no at spam.com
Sun Oct 4 14:39:50 PDT 2009
Nick Sabalausky Wrote:
> "Justin Johansson" <no at spam.com> wrote in message
> news:haavf1$2gs7$1 at digitalmars.com...
> >
> > It's a difficult challenge to get high performance, readable and
> > maintainable code out of complex number
> > intensive algorithms. Use of library types for complex numbers has, in
> > my experience been problematic.
> > Complex numbers should be first class value types I say.
> >
>
> There's been discussion before (I can't find it now, or remember the name
> for it) of type systems that allow for proper handling of things like m/s
> vs. m/(s*s) vs inch/min etc. I haven't actually worked with such a feature
> or with complex/imaginary numbers in any actual code, so I can't be sure,
> but I've been wondering if a type system like that would be an appropriate
> (or even ideal) way to handle real/complex/imaginary numbers.
> "I've also
> been wondering if it might be a huge benefit for distinguishing between
> strings that represent a filename vs file content vs file-extention-only vs
> relative-path+filename, vs absolute-path-only, etc. I've been really wanting
> a better way to handle that than just a variable naming convention.)"
Bingo. I'm sure there would be a huge benefit to be able to distinguish string or any primitive type
in such manner without having to invent a Filename class, AbsolutePathName class etc.
This whole business about types is much to do about how to construct (and validate) the
type from primitive information -- often given in lexical form. If I pass an email-address type
(even if it is really just a string) to an sendmail function, that function should not have to
revalidate/reparse the string to be sure that the string data is indeed a (lexically) valid email address.
Yeah, good point you bring up.
-- Justin Johansson
More information about the Digitalmars-d
mailing list