curiosity-ai / h5

🚀 The next generation C# to JavaScript compiler
https://github.com/curiosity-ai/h5
Apache License 2.0
210 stars 30 forks source link

+= string concatenation failing with struct to class property concat #51

Closed Ali1Jamal closed 1 year ago

Ali1Jamal commented 2 years ago

Hello i saw this issues in bridge.net and try to run it on h5 In fact, the problem also exists in h5. here is the sample : Expected: Animal Farm Actual: Animal


using System;
using H5;
using H5.Core;
using static H5.Core.es5;
using static H5.Core.dom;
using Console = System.Console;

namespace h5
{
    public struct Book
    {
        public string Title;
    }
    public class Delivery
    {
        public Book[] Books;
    }
    class Program
    {
        static void Main(string[] args)
        {

            {
                var delivery = new Delivery();
                delivery.Books = new Book[1];
                delivery.Books[0] = new Book();

                delivery.Books[0].Title = "Animal";
                delivery.Books[0].Title += " Farm";

                // Expected: Animal Farm
                // Actual:   Animal
                Console.Log(delivery.Books[0].Title);
            }
        }
    }
}
ghost commented 2 years ago

Is it possible to workaround it with delivery.Books[0].Title = delivery.Books[0].Title + " Farm";?

Ali1Jamal commented 2 years ago

Is it possible to workaround it with delivery.Books[0].Title = delivery.Books[0].Title + " Farm";?

yes its work. But the code problem must be solved ....to make h5 more stable.. and to make developers focus on bringing Modern c# features to h5

ghost commented 2 years ago

Is it possible to workaround it with delivery.Books[0].Title = delivery.Books[0].Title + " Farm";?

yes its work. But the code problem must be solved ....to make h5 more stable.. and to make developers focus on bringing Modern c# features to h5

I am sure it is not single issue with Bridge.Net which should be fixed in H5. Bridge has tons of issues.

Most buggy component for me is still DateTime.

Ali1Jamal commented 2 years ago

Is it possible to workaround it with delivery.Books[0].Title = delivery.Books[0].Title + " Farm";?

yes its work. But the code problem must be solved ....to make h5 more stable.. and to make developers focus on bringing Modern c# features to h5

I am sure it is not single issue with Bridge.Net which should be fixed in H5. Bridge has tons of issues.

Most buggy component for me is still DateTime.

yes i search in bridge.net issues to see the clear and important issues then test the code in h5 if the code have issues then i open issues in h5... I see some complaints about DataTime can you open issues Or give me examples of problems because I haven't tried it before, maybe I can fix some problems or try to reduce them

ghost commented 2 years ago

can you open issues Or give me examples of problems because I haven't tried it before, maybe I can fix some problems or try to reduce them

All my opened issues and not solved by bridge:

https://github.com/bridgedotnet/Bridge/issues/created_by/hardhub

Probably we can copy at least "defect issues" into H5 repo.

Ali1Jamal commented 2 years ago

Yes you can transfer the problems because they seem important. I'm actually trying to understand how h5 or bridge.net does some of its components works because many of them are JavaScript codes and get called by c# so its a mess in the bridge.js I think we should help each other outside github by using whatsapp or telegram until we solve these problems because I don't think one person (@theolivenbaum )is able to solve all bridge.net problems

ghost commented 2 years ago

Yes you can transfer the problems because they seem important. I'm actually trying to understand how h5 or bridge.net does some of its components works because many of them are JavaScript codes and get called by c# so its a mess in the bridge.js I think we should help each other outside github by using whatsapp or telegram until we solve these problems because I don't think one person (@theolivenbaum )is able to solve all bridge.net problems

As I know gitter is available https://gitter.im/curiosityai/h5

theolivenbaum commented 2 years ago

@Ali1Jamal the easiest is to create a blank h5 project with the code you want to test, and run H5.Compiler from within Visual Studio (or whatever IDE you're using), but targeting your project. As an example (this on VS2022)

image

Ali1Jamal commented 2 years ago

@Ali1Jamal the easiest is to create a blank h5 project with the code you want to test, and run H5.Compiler from within Visual Studio (or whatever IDE you're using), but targeting your project. As an example (this on VS2022)

image

I have no complaints about test codes . But thanks for mentioning this.