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

prototype #25

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

prototype #25

wants to merge 10 commits into from

Conversation

bunker-bunk567
Copy link

Hi there,

i did some work on cpptcl. let me know if you are interested.

  • c++ variadic templates, remove a lot of boilerplate code
  • remove a couple of map lookups for each function call (400% faster calls)
  • tie Tcl channels to std::iostreams

@bunker-bunk567
Copy link
Author

nobody interested in free quality code?

@bovine
Copy link
Member

bovine commented Oct 27, 2021

You'll need to fix the cmake problem

@bovine
Copy link
Member

bovine commented Oct 28, 2021

I haven't tried it, but you might need to add some directives like:

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

@bunker-bunk567
Copy link
Author

i will figure it out. busy elsewhere currently.

@bovine
Copy link
Member

bovine commented Nov 4, 2021

You should be able to verify the build in your own repo if you go to https://github.com/bunker-bunk567/cpptcl/actions and enable the actions

@bunker-bunk567
Copy link
Author

are there any open applications that use cpptcl? i am fairly sure my version is no longer compatible and the test cases don't cover those discrepancies.

@bovine
Copy link
Member

bovine commented Nov 5, 2021

I'm not aware of any published ones, but FlightAware internally uses cpptcl extensively and if there is API breakage then that will likely be a very significant hurdle.

@bunker-bunk567
Copy link
Author

i think we might be going different ways then. unless someone is interested at your end to change the way of doing business i see no point trying to remain compatible.

if you have future plans for TCL, you have an opportunity to improve the quality of future code.

there is still the issue of the extra std::map lookup for the policy object at each function call, which is a big unnecessary heat generator. if you move the policy object into the callback object, you can get 5 times faster function calls (backwards compatible). also you can omit some other std::map lookups for the callback object itself if you make use of TCL's ClientData mechanism.

another issue is that cpptcl object() does not properly implement sharing and takes no advantage of TCL object sharing (creating and duplicating more than would be necessary). but that is likely going to cause some breakage.

@resuna
Copy link
Member

resuna commented Nov 6, 2021

I would not rule out accommodating some changes, since this seems like a big advance in the way templates are used. We can't pull it immediately into master, but if it were merged into a branch we could migrate to it.

@bunker-bunk567
Copy link
Author

we can just leave open this pull request without intending to merge it anywhere until we change our minds about it.

i am primarily interested in improving openboardview using cpptcl as a building block, but if somebody wants to work with me on something else, they can come here.

if you point me to an application that is not too large i would see if i can improve backwards compatibility myself. it would probably end up somewhere in the middle: backwards compatible with the style, but requiring some modifications due to technical limitations. or more precisely: it would make sense to be not 100% backwards compatible.

garbage collected objects
proper lifetime management and sharing of object()'s
@bovine
Copy link
Member

bovine commented Nov 9, 2021

Perhaps splitting this PR into multiple smaller ones that are individually less disruptive to existing users would be an option?

@bovine bovine marked this pull request as draft November 16, 2021 23:14
* allow a function to be mapped with some argument conversions being applied
  useful for binding to existing code and interfaces

* allow to specify whether a function is cold or not to use different optimization
  tag all constructors and destructors and register functions as cold for all functions
  (hot and cold)

* an not yet 100% complete example GD library binding, derived and supposed to be
  compatible with tcl.gd. Code size reduced to 10%, as the original was very boilerplaty.
* value (copy) semantics for objects, embedding in Tcl_Obj->internalRep for small types
* share callback objects between interpreters
* call object methods with dot notation (. $object method args) to avoid installing
  command handlers for each individual object
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

Successfully merging this pull request may close these issues.

3 participants