Non-void methods using call by reference

Open
#89 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, python
Domain
tooling

Research direction

Start with the pywrap call-by-reference classification described in the issue and inspect GeomLib_Tool.Parameter_s as the concrete OCP example. Review cadquery/pywrap#45 and draft PR #46, then determine the compatibility impact of exposing the computed argument alongside the Standard_Boolean result; done means non-void reference-returning methods expose their computed values without an unresolved return-signature decision.

Written by the indexing model from the issue text.

Description

There are quite a few methods in OCP that use call by reference but return a value instead of void. The current implementation of pywrap classifies functions as call by reference only when the return is void.

One example in OCP is the GeomLib_Tool.Parameter_s function - the computation result is stored in the 4th argument and the function returns a Standard_Boolean indicating whether the function succeeded in finding a value. However because the function does not return void, it's not classified as call by reference and therefore the actual computed value is not accessible from callers side.

I've opened an issue to cadquery/pywrap#45 and a draft PR cadquery/pywrap#46 demonstrating a possible solution (only for functions returning Standard_Boolean). This solution adds the boolean return value to the tuple returned by the wrapper.

A downside in implementing a change like this is that it breaks backwards compatibility as some functions return signature will change.

Dominant language
C++
Stars
200
Forks
48
Avg merge
2d 2h
Merged PRs (30d)
6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from CadQuery/OCP

All issues in CadQuery/OCP

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.