Comments (3)
Here's one thing macros could sugar away: #79 (comment)
from wren.
This is a tricky one. I've spent a lot of time toying with macro systems and with the general idea of making a language "extensible" for various definitions of that. See 1, 2, 3, and 4.
If I were trying to make a big feature-full language (which is what Magpie is to a greater degree) I'd definitely be interested in this. But, I have two thoughts:
- When I played with making Magpie extensible, I found it wasn't actually that useful or usable to do so. Maybe it's a failure of imagination on my part, but I found few really compelling use cases for macros or syntax extension, and even those use cases were kind of a pain.
- They add a lot of complexity to the system. With Wren, I'm trying really really hard to keep it tiny. I think we may have a chance to make Wren a language that has real users, but the most viable path for that is as a minimal, narrowly-focused embeddable scripting language.
When I played with macros, I found the most common use case was that I wanted to define something "function-like" that could conditionally evaluate one of its arguments. So, with Wren, I just optimized exactly for that case. For example, let's say you want to have a kind of flow control construct that executes its body only on Tuesdays. In other languages, you'd need a macro. In Wren, it's just a block argument:
Calendar.onTuesday {
...
}
It has the look of something pretty seamlessly added to the language, and has the controlled lazy evaluation you want, but doesn't require the weight of a macro system. It's just a closure.
For reference, Smalltalk is considered one of the world's most "metaprogrammable" languages, and it doesn't have macros. It just uses blocks for everything. I want to see if we can do the same in Wren.
Does that make sense?
from wren.
Yes, I agree completely with regard to end-user macros. I'm not suggesting
exposing macros to users of wren, but to simplify implementation of things
like modules. Hence why I called this ticket wrenpp first. ;)
I may play around with something like this after #88.
On Thursday, January 8, 2015, Bob Nystrom [email protected] wrote:
—
Reply to this email directly or view it on GitHub
#90 (comment).
from wren.
Related Issues (20)
- [RFC] Object.responds(_) method HOT 10
- [RFC] Add routines for degrees/radians conversions HOT 21
- [RFC] Adding a `Tuple` with language support HOT 11
- [RFC] Adding `const` versions of `Object`s. HOT 9
- Class reflection for embedding HOT 3
- [RFC] `veery` lang transpiler to `wren` lang HOT 3
- [RFC] Object method message passing syntax HOT 28
- [RFC] Add `static Object.typeOf(_)` (and deprecate `Object.type` ?) HOT 9
- How can i stop wren script running? HOT 3
- Calling wren method handle from inside a bound foreign method body HOT 5
- Whitespace bugs? HOT 4
- Serialize (suspended) fibers or serialize the vm HOT 4
- wren_debug.c should use vm->config.writeFn instead of printf HOT 1
- Should we document this aspect of for loop control variable behavior?
- How do I pass a foreign object to a function call? HOT 3
- is Wren dead? HOT 2
- Where causes code to be called twice HOT 3
- How to return other foreign class obj from a foreign class ? HOT 7
- wrenCall -> foreign call causes memory corruption HOT 11
- Compound Assignments HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wren.