Code Monkey home page Code Monkey logo

dupenukem's Introduction

Kouji Matsui (kozy_kekyo)

  • ๐Ÿ”ญ Iโ€™m a self-employed Functional runtime engineer.
  • ๐ŸŒฑ Iโ€™m a Master of Arts and Science degree.
  • ๐Ÿ‘ฏ Iโ€™m looking for a job.
  • ๐Ÿ“ซ How to reach me: Mastodon @[email protected] (English) / @[email protected] (Japanese) / Twitter @kozy_kekyo (English)
  • ๐Ÿ˜„ English nickname's kozy, pronouns same as cozy. Japanese nickname's kekyo (I feel it pronounce's bit difficult :)
  • โšก Fun fact: A bicycle rider. I'm good at long riding, maybe called randonner.

Hi! my name is Kouji Matsui. Please call me kozy (pronounce same as cozy) I'm an functional runtime engineer.


Active/showcase projects


Conceptual / Early stage


Small scripts / tools


IoT / Hardware design


Point implementation


Kinda joke


Community activities


Older (Retired/Archived)

dupenukem's People

Contributors

dependabot[bot] avatar kekyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dupenukem's Issues

Improve handling ability for result type.

Will validate return type both Task and ValueTask.

public Task<int> Sum(int a, int b) => Task.FromResult(a + b);
public ValueTask<int> Sum(int a, int b) => new ValueTask<int>(a + b);

Will validate any constant return type with synchronized method/function.

.NET:

public int Sum(int a, int b) => a + b;

// Requires dirty naming (ex: namespace).
using DupeNukem.Synchronized;
messenger.RegisterFunc<int, int, int>(this.Sum);

JavaScript:

/* async */ function add(a, b) {
  return a + b;
}

Support optional arguments

Since JavaScript does not perform type checking, a method call is always variable argument length.
Therefore, we want to allow JavaScript ---> .NET calls to omit arguments in the corresponding .NET method.

Currently, the number of arguments is strictly inspected, so we add the following operations in that section.

  • If the arguments from JavaScript are shorter than the arguments of the :
    • Proposal 1: Make up all missing arguments with default values (default(T) in C#).
    • Proposal 2: If the missing arguments have default values (OptionalAttribute and DefaultParameterValueAttribute), automatically compensate (otherwise, error).

Add automatic marshaler for .NET methods

Currently, we have to register manually on .NET side methods.

So, there is an idea for:

public sealed class Foo
{
    public Task<int> Add(int a, int b) => Task.FromResult(a + b);
    public Task<int> Sub(int a, int b) => Task.FromResult(a - b);
}

var foo = new Foo();

messenger = new Messenger();

// Current strategy:
messenger.RegisterFunc<int, int, int>(foo.Add);
messenger.RegisterFunc<int, int, int>(foo.Sub);

// Automatic interpretation for declared methods:
messenger.RegisterObject(foo);

[Blazor] Add Blazor Support

How do I suppress these warnings?

image

I am running Blazor on my Webview2 . Along with this I am using your #1 (comment) example

        public Form()
        {
            InitializeComponent();

            var services = new ServiceCollection();
            services.AddWindowsFormsBlazorWebView();
#if DEBUG
            services.AddBlazorWebViewDeveloperTools();
#endif
            blazorWebView1.HostPage = "wwwroot\\index.html";
            blazorWebView1.Services = services.BuildServiceProvider();
            blazorWebView1.BlazorWebViewInitialized += BlazorWebViewInitialized;
            blazorWebView1.RootComponents.Add<Main>("#app");

        }

Support closure functions both .NET and JavaScript.

.NET proxy

public interface IJavaScriptTargetFunctionsPreDefined
{
    Task<int> add(int a, int b);
    Task<int> sub(int a, int b);
}

// Get (generate) a proxy.
var proxy = messenger.GetProxy<IJavaScriptTargetFunctionsPreDefined>();

var r1 = await proxy.add(1, 2);
var r2 = await proxy.sub(1, 2);
async function add(a, b) {
  return a + b;
}
async function sub(a, b) {
  return a - b;
}

JavaScript proxy

// "calculator" is a proxy.
window.calculator.Add(1, 2);
window.calculator.Sub(1, 2);
// (Already supported)

public sealed class Calculator
{
    public Task<int> Add(int a, int b) =>
        Task.FromResult(a + b);
    public Task<int> Sub(int a, int b) =>
        Task.FromResult(a - b);
}

// Register object AND generate a proxy into JavaScript.
var calculator = new Calculator();
message.RegisterObject("calculator", calculator);

Support Invoking Modules/Classes from JS in C#

I can see this is possible from C# to JS like so

var calculator = new Calculator();
messenger.RegisterObject(calculator)

How do I do this for JS? It seems I can only invoke functions from the window context.

Support Reactive Extension

  • .NET: IObservable<T>
  • JavaScript: rxjs

MEMO:

  • How to do lifetime management.
  • How to control delegate/function callback.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.