Re: RAD vs. performance
- From: "Curtis W" <cwarren89@xxxxxxxxx>
- Date: 9 Jul 2006 15:15:22 -0700
Jon Harrop wrote:
Curtis W wrote:What were we discussing again?
Jon Harrop wrote:
Curtis W wrote:
Is 'a * 'b a "specific type"? It is more specific than 'a but is still
polymorphic.
I was referring to types like "int|float".
That is equivalent to something like:
<add: 'a -> 'a -> 'a; ..> as 'a
How would that routine look to be inferred in such a way?
Something like this:
# let sum h t = List.fold_left h#add h t;;
val sum : (< add : 'a -> 'b -> 'a; .. > as 'a) -> 'b list -> 'a = <fun>
I meant general in the sense that it isn't a single type, but rather aNo, I wanted the specific type "expr".
"expr" is a general type, especially considering that it's a variant in
your example.
What exactly do you mean by that? It is not polymorphic.
variant. That would automatically be inferred in my language and while
OCaml can do it, it requires that you reimplement the standard library
and builtin types as objects in order to do so.
Unlikely. Really the only reason to artificially constrain a type isI'd be willing to bet that the
number of cases where you don't want to artificially constrict a type
is much higher than the number of cases where you do.
Quite the opposite in OCaml for union types.
for performance reasons given that all compatible types would work,
which I've already shown to be 1) not an issue with a decent compiler
and 2) premature optimisation.
The fact that variants are used so much proves my point: in my languageThis can be most
apparent in library code, but can also be seen in normal application
code.
Yes. Polymorphic variants (inferred unions) are rarely used and ordinary
variants (declared) are commonly used. The opposite is probably true for
product types: tuples (inferred) are probably more common than records
(which must be declared in OCaml).
the need to declare such things is completely gone. Add a new type?
That's fine, don't need to change a thing. Add a new function, that's
fine, too, don't need to change a thing.
Subtypes as in the types in the union type: a number, a variable, anthe type was
general, not specific, in that it had multiple "subtypes," if you will.
What do you mean by subtypes? It is a union type (an expression is either a
number, a variable, an addition or a multiplication).
addition or a multiplication.
I was talking about your usage of the words "general" and "specific" inAt least, that's how I've interpreted how you've used the words before.
The declared "expr" type was monomorphic. It was recursive, perhaps that is
what you're referring to?
terms of types.
That paper describes solving the expression problem, which first of allThat's exactly the same as the polymorphic variant example. Except, in
the absence of pattern matching, you'll require a lot more code.
No, it's not. If I were to put your routine in a library, for example,
and wanted to extend it with a new type I wouldn't be able to without
modifying it.
No. Read Jacques Garrigue's paper on code reuse using polymorphic variants.
Basically, they provide OO-style multiple inheritance with the brevity of
ordinary variants.
I'd already said:
In order to use any of the eval routines in another module withoutDisregarding the expression problem,
having that module "know" about them is to pass them as arguments, at
which point you're reimplementing classes.
What do you mean by "cool feature for variants"? By the way, I mightDisregarding the expression problem, the only way you'd
be able to simplify new types would be to have them pass in their
simplify function, at which point you're basically reimplementing a
class.
Exactly, yes. Although this is a cool feature for variants, it is typically
considered too costly in terms of weakening the static type system (too
much inference).
add that in my language, classes are essentially an easy syntax for
automatically passing functions around with variables. Nothing more,
nothing less.
I suspect interoperability would be the hardest part.People spent many more years working with Fortran and they have enough
such errors to alter the language and make it taboo.
Odd, people have spent many years working with Python and I've never
seen a "strict" mode for it, nor have I seen anyone complain about it.
Two of the people that I work with were discussing the prospect of writing a
statically typed Python-compatible language. Programs written in this
subset could benefit from static typing without affecting interoperability
with dynamic code.
I fail to see your reasoning.How big is epsilon? The more calculations you do, the bigger the error,
the bigger epsilon needs to be. You end up needing to track errors, which
is what interval arithmetic does. However, that still can't give you an
eq/neq answer - it can only give you a fuzzy eq/maybe/neq.
You can always change the epsilon--after all, it could easily be a
member variable of floats, which can be optimised out if not used, of
course.
That's a little too ad hoc to be useful.
Meh. Either way, my country saved you guys during WWII. Either that, orReally? My net connection costs about $30 per month.
Yeah, well! You don't have a monopoly on cable internet over their :-(
Pretty much. Telephony used to be nationalised and, now that it is
privatized, almost all companies that aren't BT are simply reselling BT
products rather than creating their own.
depending on what country you're from, we also kicked your buts.
.
- References:
- Re: RAD vs. performance
- From: Curtis W
- Re: RAD vs. performance
- From: Jon Harrop
- Re: RAD vs. performance
- From: Curtis W
- Re: RAD vs. performance
- From: Jon Harrop
- Re: RAD vs. performance
- From: Curtis W
- Re: RAD vs. performance
- From: Jon Harrop
- Re: RAD vs. performance
- From: Curtis W
- Re: RAD vs. performance
- From: Jon Harrop
- Re: RAD vs. performance
- From: Curtis W
- Re: RAD vs. performance
- From: Jon Harrop
- Re: RAD vs. performance
- From: Curtis W
- Re: RAD vs. performance
- From: Jon Harrop
- Re: RAD vs. performance
- From: Curtis W
- Re: RAD vs. performance
- From: Jon Harrop
- Re: RAD vs. performance
- From: Curtis W
- Re: RAD vs. performance
- From: Jon Harrop
- Re: RAD vs. performance
- Prev by Date: Re: RAD vs. performance
- Next by Date: Re: New Seed7 Release 2006-07-07
- Previous by thread: Re: RAD vs. performance
- Next by thread: Re: RAD vs. performance
- Index(es):
Relevant Pages
|
Loading