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

CalcManager Packaging #1545

Open
tian-lt opened this issue May 25, 2021 · 1 comment
Open

CalcManager Packaging #1545

tian-lt opened this issue May 25, 2021 · 1 comment
Assignees

Comments

@tian-lt
Copy link
Contributor

tian-lt commented May 25, 2021

CalcManager Packaging

Problem Statement

Currently, CalcManager/CalcEngine is implemented in C++ as part of Calculator. Some teams may want to reuse it as an independent library package. Besides, if we want to convert Calculator App to C#, we need to wrap the CalcEngine in C#.

Evidence or User Insights

Potential Consumers

Proposal

Concepts

Package Name Description
Ratpack Rational Package - to do arbitrary-precision rational math calculation
CalcEngine Abstraction of the calculation and commands used in Calculator
CalcManager Integration of different CalcEngine modes (Standard, Scientific, ...)

Functional Requirements

  • Calculator Engine
    (accept operator/operand commands and calculate the result to display)
  • Arbitrary-precision rational calculation
  • Expression parsing *
    • Localization support *
    • Customizable aliasing (e.g. arcsin v.s. inverse sin v.s. sin^-1) *
  • Expression evaluation *

The requirements with star (*) are not implemented yet, but will be published eventually.

Usage Requirements

CalcEngine will be consumed by ourselves and 1P teams thru NuGet package.

For us, we need a C# wrapper for CalcEngine, because we will do C# conversion for Calculator App.

In sum, we have the following usage requirements:

  • Independent NuGet package
  • C# wrapper

Portability Requirements

OS

  • Windows
    • x86
    • x64
    • ARM32
    • ARM64

Languages

  • C/C++
  • C#
    • .NET Core 3
    • .NET 5

Implementation Requirements

Ratpak and CalcEngine are implemented in C++, which won't be changed.

  • Maintain Ratpack and CalcEngine in C++
  • CalcEngine should remain in the Calculator repo

Design Proposal

Choice of Packaging Techniques

To enable interop between C++ and C#, we have 3 choices:

  1. Expose C API from C++
    consumed by C# thru P-Invoke
  2. Expose COM components from C++
    consumed by C# thru COM
  3. Expose WinRT components from C++ thru C++/WinRT
    consumed by C# thru C#/WinRT

Comparison

C API COM WinRT
Supported Platforms All Windows Only Windows Only
Supported Languages All thru FFI All with great efforts C/C++/C#/Rust/Python with WinRT library
All with great efforts
Programming Paradigm Procedure-oriented OOP OOP
Development Experience Easy😊 Painful😱 Medium😐
Community Engagement Widely used 😒 Not popular yet
Error Handling Catch all explicitly and return error code Catch all explicitly and return HRESULT Catch all implicitly by C++/WinRT library and return HRESULT
@tian-lt tian-lt self-assigned this May 25, 2021
@MicrosoftIssueBot
Copy link
Collaborator

This is your friendly Microsoft Issue Bot. I've seen this issue come in and have gone to tell a human about it.

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

No branches or pull requests

3 participants