Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Memoize (and singleton) pragmas #37

Closed
mrkmarron opened this issue Apr 18, 2019 · 0 comments
Closed

Memoize (and singleton) pragmas #37

mrkmarron opened this issue Apr 18, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@mrkmarron
Copy link
Contributor

Memoization and/or singletons with lazy initializtion are very useful patterns and important performance optimizations. In Bosque they are also semantics preserving since there is no reference identity. However, implementing them in a functaional language can be hard.

So, we want to implement "optmization pragmas" for functions/methods for singleton and memoize optmizations.

#pragma memoize(cache=256, replace="LRU")
function square(x: Int): Int {
...
}

As shown in the example we want to allow control over the size and replacement policies. We can also check that the arguments are valid for comparison at compile time.

@mrkmarron mrkmarron added the enhancement New feature or request label Apr 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant