krfkeith / silver

Automatically exported from code.google.com/p/silver
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Entirely eliminate the Production type. #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Provide an explanation of what the project should entail:

There are two "function types" in silver: Production and Function.

Production is redundant. Remove it.

Provide a concrete example of a problem this project will fix:

map_p, foldr_p, etc etc ... _p

Provide a short guide on how to start this project:

There is exactly one difference between the two types. Functions and 
Productions behave identically when they are passed around by reference (so 
eliminating the type is a-okay), but when invoking a statically known 
production or function an optimization kicks in that directly 
invokes/constructs the correct thing, rather than calling a method on an object.

You can see this in silver:translation:java:core Expr.sv in 
functionApplicationDispatcher (and the corresponding one for productions right 
next to it.)

Go look at that, or this next sentence won't make sense:  we can fix this 
difference trivially. Eliminate the 'isAppReference' attribute entirely, and 
use pattern matching (case e of functionReference -> ...) for each of these. 
Then, eliminate the production type entirely, incidentally eliminating 
productionApplicationDispatcher.  But, now it's a-okay, because it'll just 
pattern match, and pick the right case based on whether e is a 
functionReference or productionReference.  

Provide a rough expectation of what the set of patches completing this
project might look like:

One go is probably fine. Should introduce some test cases.

A second patch can eliminate all _p function from core. And all their users, of 
course.

Probable challenges in completing this project:

Note that eliminating the Production type will _NOT_ eliminate the distinct 
prodDcl and funDcl DclInfos. Only the distinct productionTypeExp and 
functionTypeExp TYPES. Distinguishing declarations is still essential.

Additional Information:

When in doubt, ask. This will probably need a code review, because it'll be 
quite invasive, touching many aspects (types, environment, dispatchers, 
translation...)  DO expect to screw this one up and need some help!

Original issue reported on code.google.com by tux...@gmail.com on 16 Jan 2012 at 12:14

GoogleCodeExporter commented 9 years ago
I am the owner!

Original comment by eric.r.v...@gmail.com on 16 Jan 2012 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by eric.r.v...@gmail.com on 16 Jan 2012 at 6:58

GoogleCodeExporter commented 9 years ago

Original comment by eric.r.v...@gmail.com on 16 Jan 2012 at 10:17