Announcement

Collapse
No announcement yet.

[CLOSED] [#554] [1.10] Inconsistencies between Bridge and .NET and Bridge v2

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [CLOSED] [#554] [1.10] Inconsistencies between Bridge and .NET and Bridge v2

    While it's certainly useful to be close to the metal (JS) when it comes to DOM manipulation and the browser, i was quite suprised that even some of the most basic methods of the BCL are either missing or even worse, signature compatible but doing something else.
    For example i've copied my Url parser from .NET to Bridge which left me with the missing String.Remove method. After replacing it, it still didn't work which was because String.Substring doesn't do what .NET String.Substring does but bridge's String.Substr, which is named confusingly and isn't named like a proper .NET method, does what .NET String.Substring does. This was quite a trap when porting that code.
    I understand that Bridge's goal is to not abstract too much away from JS (which hit me with the fact that a null check does not guard against undefined) and being readable but compatibility on these .NET primitives shouldn't be voided.

    On this note i wanted to ask what the plans are for Bridge v2. It was announced a while ago and since then nothing moved visibly in the Bridge v2 direction, v1 development kept going on and github seems untouched as far as v2 is concerned.
    Is it going to have more BCL compatibility / features and will it be OSS like Bridge v1?

    #2
    Hi Suchiman,

    Thanks for pointing out the issues with String.Remove and String.Substring. We will investigate. Both of those should have been implemented with matching C# logic. I believe String.Substr comes from the JavaScript API.

    Bridge2 development is happening privately right now. Progress is being made and we will release publicly (Apache 2) once it's in a stable condition.

    Comment


      #3
      I found the following Issues related to this topic:

      Review String implementation #385
      https://github.com/bridgedotnet/Bridge/issues/385

      Treatment of String methods should be C# or JavaScript wise? #72
      https://github.com/bridgedotnet/Bridge/issues/72

      Comment


        #4
        I created the following Issue to track this feature request:

        Implement String.Remove #554
        https://github.com/bridgedotnet/Bridge/issues/554

        Comment


          #5
          Thanks for the quick info! looking forward to bridge2! great work so far :)

          Comment


            #6
            Also created an issue to track the String.Substring implementation review:

            https://github.com/bridgedotnet/Bridge/issues/555

            Comment


              #7
              Hi Suchiman! Thank you for reporting this issue.

              We have review string implementation in Bridge1 and added Remove ansd Substring methods. It is included into release1.10.

              The list of added constructors and methods is the following:

              public String(char[] value, int startIndex, int length);
               
              public extern int LastIndexOf(char ch);
              public extern int LastIndexOf(string subString);
              public extern int LastIndexOf(string subString, int startIndex);
              public extern int LastIndexOf(char ch, int startIndex, int count);
              public extern int LastIndexOf(string subString, int startIndex, int count);
              public extern int LastIndexOf(char ch, int startIndex);
              public extern int LastIndexOfAny(params char[] ch);
              public extern int LastIndexOfAny(char[] ch, int startIndex);
              public extern int LastIndexOfAny(char[] ch, int startIndex, int count);
              public extern string Replace(char oldChar, char replaceChar);
              public extern string[] Split(char[] separator);
              public extern string[] Split(char[] separator, int limit);
              public extern string[] Split(char[] separator, int limit, StringSplitOptions options);
              public extern string[] Split(char[] separator, StringSplitOptions options);
              public extern string[] Split(string[] separator, StringSplitOptions options);
              public extern string[] Split(string[] separator, int limit, StringSplitOptions options);
              public extern string[] Split(string separator);
              public extern string[] Split(char separator);
              public extern string[] Split(Regex regex);
              public extern string[] Split(char separator, int limit);
              public extern string[] Split(Regex regex, int limit);
              public extern string[] Split(string separator, int limit);
              public string JsSubstring(int indexA)
              public string JsSubstring(int indexA, int indexB)
              public string Substring(int start)
              public string Substring(int start, int length)
              public extern string Trim(params char[] values);
              public extern string TrimStart(params char[] values);
              public extern string TrimEnd(params char[] values);
              public extern string TrimStart();
              public extern string TrimEnd();
              public extern int CompareTo(string other);
              public extern string Insert(int startIndex, string value);
              public static extern string Join(string separator, params string[] args);
              public static extern string Join(string separator, params object[] args);
              public static extern string Join(string separator, IEnumerable<string> args);
              public static extern string Join<T>(string separator, IEnumerable<T> args);
              public static extern string Join(string separator, string[] args, int startIndex, int count);
              public extern string PadLeft(int totalWidth);
              public extern string PadLeft(int totalWidth, char ch);
              public extern string PadRight(int totalWidth);
              public extern string PadRight(int totalWidth, char ch);
              public extern string Remove(int index);
              public extern string Remove(int index, int count);

              Comment

              Working...
              X