6 Commits

Author SHA1 Message Date
faff0d6ca4 blog; formatting 2019-09-30 23:03:45 -07:00
8ce631e80e blog; add 0.2.0/0.3.0 post 2019-09-30 22:48:04 -07:00
5338275dcd 0.2.0 prep work 2019-09-30 21:38:08 -07:00
3eb4ac1419 Add a clearer error message for forward declared lowercase variables (#699)
* Add better error messaging for forward referenced top level variables, see #467
* add test case
2019-09-30 20:30:27 -07:00
fc7bd1c78f Merge pull request #703 from mwilmsm/master
Cleaned up some documentation typos. -mw
2019-09-30 13:23:51 -07:00
265bcc6780 Cleaned up some documentation typos. -mw 2019-09-30 09:02:55 -05:00
12 changed files with 182 additions and 19 deletions

View File

@ -1,3 +1,44 @@
## 0.2.0
0.2.0 spans a pretty wide time period with [around 290 commits](https://github.com/wren-lang/wren/compare/0.1.0...master).
This includes many bug fixes, improvements, clarity in the
code and documentation and so on. There's too many to explicitly list.
Below is the obvious user facing stuff that was easy to spot in the history.
Most noteworthy is that 'relative imports' are a slightly breaking change,
but help pave the way forward toward a consistency for modules.
### Language/VM
- `import` was made smarter, differentiating relative from logical
- `Fiber` can now accept a value from the first `call`/`transfer`
- Added `String.trim`, `String.trimEnd`, `String.trimStart` variants
- Added `String.split`, `String.replace`, `String.fromByte`
- Added `String.indexOf(needle, startIndex)`
- Added `Sequence.take` and `Sequence.skip`
- Added `List.filled(count, value)`
- Added `Num.pow`, `Num.log`, `Num.round`
- Added `Num.largest`, `Num.smallest`
- Added `Map` iteration (`MapEntry`)
#### C API
- Added `wren.hpp` for use in c++
- Added void* user data to `WrenVM`
- Allow hosts with no module loader to still load optional modules.
- Added `wrenAbortFiber`
### CLI
Please note that beyond 0.2.0 the CLI will have it's own changelog.
This list is not exhaustive. For a fuller history see the commit log above.
- Add path module
- Add `--version`
- Add REPL written in Wren
- Add Stdin.isTerminal
- Added Platform class
- Rename `process` module to `os`
## 0.1.0
First declared version. Everything is new!

View File

@ -0,0 +1,90 @@
^title 0.2.0 and beyond
30 Sep 2019
---
### 0.2.0 is here
It's time to tag a release!
Let's check our goals from [the last blog post](http://wren.io/blog/hello-wren.html):
- <s>We're gonna clear out a bit of backlog, tidying up issues and PRs</s>
- <s>Tidy up the website a bit, visually and structurally</s>
- <s>Make sure all documentation is up to date with the current development</s>
- <s>Tag 0.2.0 with a list of relevant changes since 0.1.0</s>
So far so good.
### Backlog
Clearing out the issues on a repo after some time has passed is always a bit tricky.
Many issues are outdated (or unrelated), and some need a proper response. Some are related to future ideals, things that will take a while to get to. Some are related to the Wren CLI. It can be difficult to reason about the state of the tasks when they're all over the place, so we've been consolidating.
The good news is the issue list has been drastically reduced, 70+ issues being closed (or resolved). Around 21 of those are marked for future consideration, and 23 moved to the Wren CLI repository. More consolidation will still continue.
**The goal is that the active issues are as relevant as possible in the immediate term.**
A tricky but important aspect to mention here is the perception of closing an issue...
A closed issue doesn't necessarily mean anything final, it's just a categorization tool!
The other categorization tool which operates _within_ open/closed categories, is the _label_. Labels allow us to distinguish clearly the different types of issues, which makes open/closed less binary and more nuanced and rich. We rely on both to make sense of the list.
For example, discussions of future tasks, ideas or goals [are tagged `future`](https://github.com/wren-lang/wren/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Afuture+). Now we can refer to them later, and re-open them when they become active and relevant again.
**We're in this together.**
Please don't be discouraged if an issue is closed! Discussion is absolutely encouraged and ideas, proposals and input is very necessary. Feel free to keep a discussion going, even if the issue it's attached to has been marked as closed.
### 0.2.0
We've been hammering away on Wren since 0.1.0 for quite a while. The [change list on Github](https://github.com/wren-lang/wren/compare/0.1.0...5338275dcdd97fd8d9fc614f420a645500836a59) is too long to display!
Most importantly, before we start iterating on the language further, I wanted to make sure we had a checkpoint to look back to. That's largely what 0.2.0 is about.
There's quite a lot of good changes, with **290 commits from 41 contributors!**
Thanks to everyone getting involved, every little bit has helped Wren, no matter how small the contribution.
### 0.3.0
With 0.2.0 wrapped up, our next release won't be as far away this time.
**The primary goal for 0.3.0 is separating the VM from the CLI.**
This includes updated documentation, splitting the source repos, migrating all the tests, issues and more.
All the code and documentation will still be easy to access in one place, but clarity around Wren as a project will improve a lot.
The migration has already started, you can [find the wren-cli repository here](https://github.com/wren-lang/wren-cli).
I'm working on some of the refactoring on the [wren-cli-refactor branch.](https://github.com/wren-lang/wren/tree/wren-cli-refactor)
With that, we'll also have a cleaner build process for the CLI.
On some platforms (Windows especially), there have been several pain points, these will be addressed.
There's also gonna be an additional build target, namely emscripten, so we can easily run Wren examples on the Wren website and documentation.
And finally, we'll have some proper prebuilt releases with 0.3.0.
I know many people have just wanted to grab an executable and give the language a go, but that hasn't been an option.
We'll fix that with 0.3.0.
The 0.3.0 goals in simple form:
- VM / CLI split
- Build consistency/reliablity
- Web build for embedding in docs
- Prebuilt releases
### Beyond
I don't have any concrete plans for 0.4.0 right now, but once the dust settles from 0.3.0 we'll have a clearer view.
There's definitely things in the pipeline though, I've been playing with [adding compound assignments like `+=`](https://github.com/wren-lang/wren/pull/701).
More details about in development features and fixes can be found on the repo in the meantime.
Thanks for reading!
### More
- [The Wren Blog RSS](http://wren.io/blog/rss.xml)
- Visit the [wren-lang organization](https://github.com/wren-lang) on Github to get involved.
- Follow the developers [@munificentbob](https://twitter.com/munificentbob) or [@___discovery](https://twitter.com/___discovery) on twitter

View File

@ -1,5 +1,8 @@
^title Development blogs
[<h3>0.2.0 and beyond</h3>](0.2.0-and-beyond.html)
> <date>30 Sep 2019</date> • Checkpoints, and the plans for 0.3.0.
[<h3>System.print("hello wren")</h3>](hello-wren.html)
> <date>4 Feb 2019</date> • A short post introducing the blog, the new maintainer, and the immediate term plans for Wren.

View File

@ -3,6 +3,13 @@
<link>https://wren.io/</link>
<description>The development blog of the Wren programming language.</description>
<language>en-us</language>
<item>
<title>0.2.0 and beyond</title>
<link>https://wren.io/blog/0.2.0-and-beyond.html</link>
<description>Checkpoints, and the plans for 0.3.0.</description>
<guid>https://wren.io/blog/0.2.0-and-beyond.html</guid>
<pubDate>Mon, 30 Sep 2019 00:00:00 GMT</pubDate>
</item>
<item>
<title>System.print("hello wren")</title>
<link>https://wren.io/blog/hello-wren.html</link>

View File

@ -107,7 +107,7 @@ of the body, like so:
System.print("Hi, " + first + " " + last + "!")
}
Here we're passing a function to `greet` that takes two parameters, `first` and
Here we're passing a function to `callMe` that takes two parameters, `first` and
`last`. They are passed to the function when it's called:
:::wren

View File

@ -67,7 +67,7 @@ use `add` to append a single item to the end:
:::wren
hirsute.add("goatee")
System.print(hirsute.count) //> 4
System.print(hirsute.count) //> 5
You can insert a new element at a specific position using `insert`:

View File

@ -7,11 +7,11 @@
// The Wren semantic version number components.
#define WREN_VERSION_MAJOR 0
#define WREN_VERSION_MINOR 1
#define WREN_VERSION_MINOR 2
#define WREN_VERSION_PATCH 0
// A human-friendly string representation of the version.
#define WREN_VERSION_STRING "0.1.0"
#define WREN_VERSION_STRING "0.2.0"
// A monotonically increasing numeric representation of the version number. Use
// this if you want to do range checks over versions.

View File

@ -1253,9 +1253,11 @@ static int declareVariable(Compiler* compiler, Token* token)
// Top-level module scope.
if (compiler->scopeDepth == -1)
{
int line = -1;
int symbol = wrenDefineVariable(compiler->parser->vm,
compiler->parser->module,
token->start, token->length, NULL_VAL);
token->start, token->length,
NULL_VAL, &line);
if (symbol == -1)
{
@ -1265,6 +1267,12 @@ static int declareVariable(Compiler* compiler, Token* token)
{
error(compiler, "Too many module variables defined.");
}
else if (symbol == -3)
{
error(compiler,
"Variable '%.*s' referenced before this definition (first use at line %d).",
token->length, token->start, line);
}
return symbol;
}
@ -2236,13 +2244,7 @@ static void name(Compiler* compiler, bool canAssign)
token->start, token->length);
if (variable.index == -1)
{
if (isLocalName(token->start))
{
error(compiler, "Undefined variable.");
return;
}
// If it's a nonlocal name, implicitly define a module-level variable in
// Implicitly define a module-level variable in
// the hopes that we get a real definition later.
variable.index = wrenDeclareVariable(compiler->parser->vm,
compiler->parser->module,

View File

@ -1150,7 +1150,7 @@ static ObjClass* defineClass(WrenVM* vm, ObjModule* module, const char* name)
ObjClass* classObj = wrenNewSingleClass(vm, 0, nameString);
wrenDefineVariable(vm, module, name, nameString->length, OBJ_VAL(classObj));
wrenDefineVariable(vm, module, name, nameString->length, OBJ_VAL(classObj), NULL);
wrenPopRoot(vm);
return classObj;

View File

@ -456,7 +456,7 @@ static ObjClosure* compileInModule(WrenVM* vm, Value name, const char* source,
wrenDefineVariable(vm, module,
coreModule->variableNames.data[i]->value,
coreModule->variableNames.data[i]->length,
coreModule->variables.data[i]);
coreModule->variables.data[i], NULL);
}
}
@ -1498,8 +1498,15 @@ int wrenDeclareVariable(WrenVM* vm, ObjModule* module, const char* name,
return wrenSymbolTableAdd(vm, &module->variableNames, name, length);
}
// Returns `true` if [name] is a local variable name (starts with a lowercase
// letter).
static bool isLocalName(const char* name)
{
return name[0] >= 'a' && name[0] <= 'z';
}
int wrenDefineVariable(WrenVM* vm, ObjModule* module, const char* name,
size_t length, Value value)
size_t length, Value value, int* line)
{
if (module->variables.count == MAX_MODULE_VARS) return -2;
@ -1516,9 +1523,14 @@ int wrenDefineVariable(WrenVM* vm, ObjModule* module, const char* name,
}
else if (IS_NUM(module->variables.data[symbol]))
{
// An implicitly declared variable's value will always be a number. Now we
// have a real definition.
// An implicitly declared variable's value will always be a number.
// Now we have a real definition.
if(line) *line = AS_NUM(module->variables.data[symbol]);
module->variables.data[symbol] = value;
// If this was a localname we want to error if it was
// referenced before this definition.
if (isLocalName(name)) symbol = -3;
}
else
{

View File

@ -163,12 +163,15 @@ Value wrenFindVariable(WrenVM* vm, ObjModule* module, const char* name);
int wrenDeclareVariable(WrenVM* vm, ObjModule* module, const char* name,
size_t length, int line);
// Adds a new top-level variable named [name] to [module].
// Adds a new top-level variable named [name] to [module], and optionally
// populates line with the line of the implicit first use (line can be NULL).
//
// Returns the symbol for the new variable, -1 if a variable with the given name
// is already defined, or -2 if there are too many variables defined.
// Returns -3 if this is a top-level lowercase variable (localname) that was
// used before being defined.
int wrenDefineVariable(WrenVM* vm, ObjModule* module, const char* name,
size_t length, Value value);
size_t length, Value value, int* line);
// Pushes [closure] onto [fiber]'s callstack to invoke it. Expects [numArgs]
// arguments (including the receiver) to be on the top of the stack already.

View File

@ -0,0 +1,5 @@
if (false) {
System.print(a)
}
var a = 123 // expect error: Error at '123': Variable 'a' referenced before this definition (first use at line 2).