about summary refs log tree commit diff stats
path: root/LICENSE
blob: 67e22c37c3a994e66539612cb02de910eca91baa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
MIT/X Consortium License

(C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
(C)opyright MMVI Sander van Dijk <a dot h dot vandijk at gmail dot com>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the 
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in 
all copies or substantial portions of the Software. 

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL 
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
DEALINGS IN THE SOFTWARE.
lexical scopes in other languages.) :(scenario surrounding_space) # location 1 in space 1 refers to the space surrounding the default space, here 20. recipe main [ 10:number <- copy 5 # pretend array 20:number <- copy 5 # pretend array default-space:address:array:location <- copy 10/unsafe 0:address:array:location/names:dummy <- copy 20/unsafe # later layers will explain the /names: property 1:number <- copy 32 1:number/space:1 <- copy 33 ] recipe dummy [ ] # chain space +mem: storing 20 in location 11 # store to default-space +mem: storing 32 in location 12 # store to chained space +mem: storing 33 in location 22 //: If you think of a space as a collection of variables with a common //: lifetime, surrounding allows managing shorter lifetimes inside a longer //: one. :(replace{} "long long int space_base(const reagent& x)") long long int space_base(const reagent& x) { return space_base(x, space_index(x), current_call().default_space); } long long int space_base(const reagent& x, long long int space_index, long long int base) { if (space_index == 0) { return base; } long long int result = space_base(x, space_index-1, get_or_insert(Memory, base+1)); return result; } long long int space_index(const reagent& x) { for (long long int i = /*skip name:type*/1; i < SIZE(x.properties); ++i) { if (x.properties.at(i).first == "space") { if (!x.properties.at(i).second || x.properties.at(i).second->right) raise_error << maybe(current_recipe_name()) << "/space metadata should take exactly one value in " << x.original_string << '\n' << end(); return to_integer(x.properties.at(i).second->value); } } return 0; } :(scenario permit_space_as_variable_name) recipe main [ space:number <- copy 0 ]