Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The next version of squirrel,Can you add integrated binding to C + + 20 ranges syntax? #246

Open
D22699 opened this issue Feb 6, 2022 · 4 comments

Comments

@D22699
Copy link

D22699 commented Feb 6, 2022

Squirrel is very easy to use~~~

Thanks for the development of @albertodemichelis ! Only after version 3.1 was updated in 2016, there was no news again?

Recently, the new features of C + + 23 standard have been added a lot? Ranges has the most features, and ranges has become the biggest winner. Our question is, can we integrate and bind the ranges syntax above C + + 20 in squirrel? Because it's so convenient to write business code with ranges!

Ranges realizes a variety of parallel combined filtering operations and other operations through pipeline symbols, which should also be the core functional goal of the next generation of squirrel. It not only saves a lot of code, but also greatly increases the flexibility of the algorithm!

In addition, can squirrel support the isolation of multi sub table data and operations? We hope that on the basis of the root table, there can be completely independent sub tables, which can support the same name of objects, and the algorithm can be limited to a certain sub table. C + + 20 provides modules, realizes a high degree of isolation, and even isolates Hongdu? Is there a similar feature in JS? For example, if we declare in the root table and instantiate in different sub tables, the algorithm and object will not be afraid of the problem of duplicate names, and the data will be effectively isolated? In this way, it is convenient to write a large amount of business code.

We are highly optimistic about squirrel and hope @albertodemichelis can give an answer!

thank! thank! thank!

@zeromus
Copy link
Contributor

zeromus commented Feb 8, 2022

I unpacked all the questions from this, while trying to understand it

  1. can the squirrel .h API include "ranges" style code from c++ standards from the future... for... what exactly? iterating over table elements? Not likely, since squirrel doesn't even really offer anything from c++ standards from the past
  2. can squirrel support "multi sub table data". I guess this means multiple inheritance?
  3. asking about whether JS has something like C++ "modules", but for some reason using the "sub tables" terminology and sounding like the exact same question. I presume once it's established that JS has something like c++ "modules", the follow-up would be can squirrel have it too?
  4. I doubt anyone knows what "hongdu isolation" means but I am going to guess it's something like a vow of abstinence for a period which clears your mind and helps you write cleaner code

And all the same questions were asked in another thread, where it should be deleted.

@rversteegen
Copy link

The post has clearly been run through a translator so is hard to understand. Since "ranges syntax" was mentioned, I think the request is for the ability to write a compound function call using pipe operators, e.g. (stealing an example from elsewhere) vec | foo | bar(3) | baz(7) is equivalent to baz(bar(foo(vec), 3), 7). In C++ that's accomplished with operator overloading and template gobbledygoo but in a scripting language it could be builtin syntax, preferably not overloading |.

But is there really much benefit to that syntax?

@D22699
Copy link
Author

D22699 commented Feb 8, 2022

sense @rversteegen @zeromus

The point is C++ 20 "ranges",squirrel won't support "ranges",But can you provide an indirect binding method?

“range = vec | foo | bar(3) | baz(7) | baz(bar(foo(vec), 3), 7)”

Hopefully, squirrel supports "ranges" and it will be more convenient to write business code.

@rversteegen
Copy link

Oh, if you want a way to create a binding to a C++ range, then I think that doesn't require any changes to Squirrel, it can just be a library which creates a proxy object (a userdata?). Maybe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants