Comments (5)
You might be able to use #line local
to make new variable declarations from #format and most other commands local.
That might reduce the number of declarations.
from tintin.
Nice. WHY I FORGOT THIS.
But one problem with #line local
in practice is that it introduces a layer of indentation that makes the whole block of code incoherent. Like this:
#alias foo {
........
........
#line local {
..........
..........
};
........
........
#line local {
..........
..........
};
........
........
};
Unless I wrap the whole block in #line local, like this:
#alias foo { #line local {
......
......
}};
Looks a bit strange. But I tried to give #line local
to the front and it doesn't work properly again.
#line local #alias foo {
.......
.......
};
If only there was some way to make #alias/#action/#func
all use local by default (unless declared with #var
).
This would effectively prevent different parts of the code block from reading the wrong values.
Or, simply, allowing #local
to declare multiple variables at once might be a good way to go.
from tintin.
#alias foo { #line local {
......
......
}};
That would be the correct way to go about it since #line creates its own scope.
You could use nesting:
#local temp {};
#format temp[name] %-10s x;
#math temp[other_name] 1+1
from tintin.
I understand that #alias foo { #line local {
is good, but it looks a bit strange. Is it possible to make it a little more pretty?
from tintin.
I don't think so. There's also the foreach route:
#foreach {bli;bla;blo} {item} #local $item {}
from tintin.
Related Issues (20)
- Seg fault with math HOT 2
- should we put ; at the end of #case? HOT 4
- pty question / wasm HOT 7
- Question -- disable color HOT 2
- Request a new event to be notified that the #function is missing HOT 1
- `\x00` cannot be sent via the `#send` command when `#config charset GBK1TOUTF8` HOT 5
- When a undefined class is killed,The event "CLASS CREATED" would trigged HOT 4
- when delete the only one step in path mapping, tintin crashed HOT 2
- Request a method to get the name of the #class that is currently open. HOT 2
- about #draw and #button HOT 2
- #PORT init issue - gethostbyname error 0 HOT 3
- [REQUEST] Is it possible to add i18n support to TinTin++? HOT 1
- backslashes have strange behavior when used as a key in table HOT 4
- Turning on COLOR PATCH and RECEIVED OUTPUT will cause the entire game to lose any color HOT 2
- You can't trig a action "out of range" that created by a locally variable HOT 3
- Update BSD section in install guide HOT 2
- HAVE_GNUTLS_H is defined to empty string HOT 1
- regex looks like it has a bug about grouping but not capturing HOT 3
- BUG: the return value of utf8_to_gbk1 seems incorrect HOT 3
- #draw tile gives an error when drawing { HOT 2
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 tintin.