Comments (6)
Couldn't it be written as a template?
It would be quite helpful to specify in a comment in which corner of the screen is (0, 0) located to avoid the usual confusion.
Depending on the context "inside" may confuse the reader, I'd rename is_inside() to valid().
Also, s/custompos/name/ in the sample code.
from stechec2.
Yeah please don't use macros unless made absolutely necessary by lack of language support. Let alone 100 line macros
from stechec2.
This kind of feature is not possible with templates. At least not unless there is some reflexivity in the language, which may be possible with c++20.
If we were to do this in C++, the macro is the only way to go.
But since this is one ugly macro, we probably do not want to use it. I added it for reference. The best way to go is to generate a file with what would be the expansion of this macro. stechec2-generator
could write the C++ file directly. Note that it is not very different to have it done by, ruby, python, or a C++ macro, but at least once the code is generated, we have some clean C++ code.
Also with c++20, we will be able to get rid of the comparison operators, but this is in a long time.
I have indeed forgotten to remove custompos
for the macro, I’ll edit the post.
from stechec2.
So, what is the problem in simply copy pasting the file from year to year?
from stechec2.
It makes writing the rules slower. And copy/pasting is often a bad thing.
from stechec2.
From a discussion on IRC, I think we agree on the fact that this is like a third party dependency you would inline like a stackoverflow snippet etc, and it's game-specific so there's little need to generate that.
from stechec2.
Related Issues (20)
- generator: ocaml: flush the user_functions in C++ code, not OCaml HOT 1
- generator: handle user functions with args and a return value HOT 2
- C# generator: fix broken struct/array handling HOT 1
- generator: python errors are never shown HOT 1
- C# boolean arrays do not work
- Implement dry run mode for clients HOT 3
- Versioning/timestamp of states for TurnBasedRules HOT 3
- Add --validate-map flag to the server HOT 1
- rules generator assumes that actions error type is called `error` HOT 6
- rules generator generates french display functions HOT 1
- rules generator generates two definition for type display functions HOT 1
- Config slots option is ambiguous HOT 1
- haskell generator doesn't handle tuples
- Rust generator doesn't handle tuples of structs
- generator: more idiomatic language APIs for errors and optional values HOT 11
- Generator: add unit tests for tuples HOT 1
- Generator: command to check that a .yml compiles in all languages
- Generator: support constants of arbitrary types HOT 5
- Python generators should generate a .pyi file to enable autocompletion HOT 3
- Generator: constants are not tested in most languages 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 stechec2.