Q&A on "Why XLang Is an Innovative Programming Language"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyrinNew
    Senior Member
    • Feb 2024
    • 5175

    #1

    Q&A on "Why XLang Is an Innovative Programming Language"

    In my previous article Why XLang Is an Innovative Programming Language, I introduced the design philosophy of XLang and explained that XLang is innovative because it creates a new program structure space where it is convenient to implement the computation paradigm proposed by Reversible Computation theory: Y = F(X) + Delta. This article provides further explanations addressing feedback and questions.


    1. How can Delta computation be compressed to compile-time execution based on XLang?


    To implement property inheritance, UIOTOS made a lot of special designs and introduced a significant amount of code related to property inheritance in its runtime engine. However, based on the XLang language, Delta computation can be completely compressed to compile-time; the runtime engine only needs to understand ordinary component structures and does not need any knowledge of Delta decomposition or merging.





    UIOTOS is a no-code platform for the IoT domain. It introduces a container component that can embed an existing page and then use a property mechanism to override properties of objects within the page. This achieves flexible customization of the page content without reimplementing the page.






    {
    type: "container",
    baseUrl: "a.page.json",
    overrideProps: {
    "form/title": "sss",
    "actions/0/label": "vvv"
    }
    }







    The general approach is as shown above: essentially, the page object is brought in via baseUrl, and then multiple inherited properties are used to override content within the page object. With a syntax similar to JsonPath, you can modify any nested content within the page object, so it differs from conventional component frameworks where you call a component and pass parameters to it.


    UIOTOS writes considerable code in the frontend runtime framework specifically for property inheritance and needs to introduce a special container control. A limitation of the UIOTOS approach is that it can only override property values in existing pages and cannot change the structure of the inherited page. Another low-code platform uses a similar approach without introducing a special container component; it allows Delta customization for any component. Concretely, it introduces a special overwrite property within the component.






    {
    "component": "MyComponent",
    "version" : "1.0",
    "properties": {
    "a": 1, // Set component property directly
    },
    "overwrite": [
    "Here we record the visual editor’s edit actions on the component"
    ]
    }







    The basic operation pattern is: after dragging a component in the editor, if some details need adjustment, you can enter a component customization mode to fine-tune the component in the visual designer. The adjustment steps are automatically recorded as overwrite and saved in the page file. This approach can arbitrarily adjust component structure and is more adaptable than UIOTOS’s approach. However, recording operation actions is verbose, and multiple actions are hard to compress into a concise final result (i.e., it does not leverage the associative law for simplification).


    According to Reversible Computation theory, A = 0 + A; full content is a special case of Delta. We can define full content and Delta in a unified form, so the Delta of a Delta is also just another normal Delta, enabling more complex logical reasoning. Using action-based overwrite to represent a Delta is not suitable.


    Regardless of which approach is used above, the editor and frontend runtime framework both need to incorporate handling code related to the Delta concept. However, if XLang is used as the underlying model expression language, Delta computation can be completely compressed to compile-time; the runtime engine only needs to understand ordinary component structures with no knowledge of Delta decomposition or merging. The specific method uses x:extends for component inheritance.






    x:schema="component.xdef">
    from="comp:MyComponent/1.0.0"/>

    name="MyComponentEx" x:extends="comp:MyComponent/1.0.0">



    name="a" xverride="remove"/>

    name="b"/>


    xverride="merge">
    Only show the Delta-corrected portion here

    x:extends="a.form.xml">

    name="ss" x:id="ss"/>













Working...