Small poll

Erik Stenman Erik.Stenman@REDACTED
Thu Dec 11 10:41:40 CET 2003


You must be kidding, right?

As it is now the compiler always does constant propagation and folding.
If you write:
  A = 1 + 2,
you get
  A = 3,
in the compiled beam code. 
(These types of expressions do come up, especially if you are using
macros...)

The problem is that if you write
  a + 1,
then the compiler has to spend extra time compiling the expression, handling
the
special case that constant folding does not work, and produce larger
code than necessary.

> I would not like having anyone wasting their valuable time 
> improving the compiler to catch this 

This already has to be cached and handled by the compiler.

> and also wasting more 
> CPU power on everyones computer when compiling.

More CPU power is probably used today in order to 'fix' this
special case, at least for native code.  

Erik

> -----Original Message-----
> From: owner-erlang-questions@REDACTED 
> [mailto:owner-erlang-questions@REDACTED] On Behalf Of Peter Lund
> Sent: Thursday,11 December, 2003 09:11
> To: kostis@REDACTED
> Cc: erlang-questions@REDACTED
> Subject: Re: Small poll
> 
> I am certainly putting my money on no 1!
> 
> The case when "a + 32" craches my code will be easily 
> detected the first time I run that piece of code, and since I 
> *do* test my code before delivery, this is a non-problem. I 
> would not like having anyone wasting their valuable time 
> improving the compiler to catch this and also wasting more 
> CPU power on everyones computer when compiling.
> 
> /Peter
> 
> > which is either crap (arguably) or a typo (A vs a), how many Erlang 
> > users:
> >
> >  1. Are content with the current situation where the compiler
> > 	happily compiles this program
> >  2. Would like to see a warning, but a .beam file generated
> > 	nevetheless
> >  3. Would prefer if the compiler in R10 refused to compile it
> >
> > Notice I am not talking about any serious attempt to static type 
> > checking, but for really "basic" checks.
> >
> > Kostis.
> 
> 
> 
> 




More information about the erlang-questions mailing list