Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Mohammad Hamdy Ghanem
    @VBAndCs
    I already solved the issue and aray initializerscworks now in sb (will puplish it in minutes) :)
    I totakly avoided il. I tried to deliver to the il generator only the syntax it understands
    So, i loweted the code in the emit phase to avoid altering the source code text
    Mohammad Hamdy Ghanem
    @VBAndCs
    To do that, i cteated the lowed code as a separit code, parsed and analyzed it, then added the resuling info to the original compilation,. Finally i used the same generator scope to emit il for the new parse tree of the lowered code
    And since i am already in the middle of ghe emmit phase, the il for the lowered code is its right pos, and of course i don't emit anything for the original array initializer
    Il spy is a grate help, since i used it to figure out what i did wrong in emmiting il.
    Mohammad Hamdy Ghanem
    @VBAndCs
    Small basic compiler is super easy. It is not efficient for real world apps, because the primitive type is bad for business. It represens string, douple and string array, which is acually a string dictionary, that is serialised as a string and saved in the string field! The idea is brilliant, making sb easy for kids and the compiler itself is very small, but of course ghis makes the language kess efficient
    I like it that way. It should always be for educational purpose.
    I am just doing some enhancements to make it more enjoyable for kids.
    Mohammad Hamdy Ghanem
    @VBAndCs
    By the way i restored next and wend to for and while loops. Endfor and endwhile are still valid, but the editor auto inserts next and wend. I hate end while in vb.net and use do loop insteed. End kills the loop. Basic is all about readability and consistency.
    Mohammad Hamdy Ghanem
    @VBAndCs
    Mohammad Hamdy Ghanem
    @VBAndCs
    Mohammad Hamdy Ghanem
    @VBAndCs
    Small Visual Basic 1.0 is ready for preview. Please report any issues. I think it will be fun for kids and beginners. I will include some more windows controls in the release version, but now I want to make sure sVB is stable in its current state.
    https://github.com/VBAndCs/sVB-Small-Visual-Basic/releases/tag/v1.0-preview
    Adam Speight
    @AdamSpeight2008

    re @paul1956 @CyrusNajmabadi

    I think it was proposed to replace the For loop to handle the edge cases. While i.Inbetween(Byte.Min, Byte.Max, Step:=2) But maybe Adam had something else in mind.

    I am just thinking about the clauses used in Case Statements, to see if I can extract the out in a general pattern matching syntax.

    Select Case operand
           Case min To max Step stepping
           Case Else
    End Select

    So thinking about a smarter lowering, for the step case.

    CyrusNajmabadi
    @CyrusNajmabadi
    i genuinely don't understand what the stepping has to do with here.
    what is the use case?
    start with the real world scenario where you need this. otehrwise it just seems strange and unneeded in the language
    Mohammad Hamdy Ghanem
    @VBAndCs
    If x mod 2 = 1 andalso x >= 3 andalso x<=11
    Select case x: case 3 to 11 step 2
    Seems nice
    CyrusNajmabadi
    @CyrusNajmabadi
    when woudl you write that code?
    put another way: absent an actual demonstrative compelling use case, there's no way we would take such a change in the langauge
    Cory Smith
    @DualBrain
    Is there a desire to somehow change the stepping while the loop in executing? Or is this something that is somehow trying to determine a calculated stepping amount depending on the quantity of the min and max before the initial loop starts?
    CyrusNajmabadi
    @CyrusNajmabadi
    i legit don't even knwo the scenario this is trying to improve
    i've asked this a few times with no response :)
    stepping back: we do not make language changes speculatively
    100% of hte time we have at least 1 scenario we know of that can act as hte examplar of why we'd want this
    this is the canonical example we can use when thinking about this space to go: ah yes... i see why we'd want this
    as well as: ah yes, this solution seems to at least actually solve taht use case.
    because you'd be surprised by how many language requests can't actually even give a case where they would be used, and how many requests ask for something that doesn't even adequately solve the case provided! :)
    Cory Smith
    @DualBrain
    @CyrusNajmabadi agreed. I'm having a hard time imagining what this might entail; one one hand I'm "why would this ever be needed" while on the other I'm "looks like there is something I might be missing here... some idea that I'm too thick headed to see".
    Mohammad Hamdy Ghanem
    @VBAndCs

    VB gives non-sense errors regarding ArressOf. See this sample:

    class Designer
        sub Designer_Loaded()
    
        End Sub
    
        Shared Sub Foo()
            AddHandler CurrentPage.Loaded, AddressOf Designer_Loaded ' Error 1
            AddHandler CurrentPage.Loaded, AddressOf Designer.Designer_Loaded ' Error 2
            AddHandler CurrentPage.Loaded, AddressOf CurrentPage.Designer_Loaded ' OK
        End Sub
    
    End class

    Error 1:

    annot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.

    Error 2:

    Reference to a non-shared member requires an object reference.

    I think it is not right to treat the method address as if it is a method call and apply the same roles of shared and instance methods.
    A method address is just a name of a method that belongs to the class, and should be references to the class name (optional if within the class)
    method address should never be referenced to an object name defined of the class! This can't be right.
    Cory Smith
    @DualBrain
    This isnt the case... there are variable scoping rules in effect and the most likely outcome would be a runtime error. There is, however, things in place that would indicate that the target method should be marked as shared if it could be (warning) so if it were possible to write this code... the warning would have been ignored at this point... which would suggest that the dev intends on maybe accessing member variables.
    The two different errors is because you wrote two different ways... one that could find the method in the same class and the other that could have been written literally anywhere in the project.
    CyrusNajmabadi
    @CyrusNajmabadi
    @DualBrain hit it on the head
    Mohammad Hamdy Ghanem
    @VBAndCs
    As far i know, in iil, there is no instance methodes, but all methodes rseems like attached methods and recive an instance of the class to work on
    So, when i wtite addhandler object.event, addressof method
    I aleady supplied all info: the instance is object, and the method name is method
    If the call is in a shared sub, vb can easily know that i mean object.method beacuase i stated the object already in the event part
    I don't need to add the object unless i want to use a method from another object which will never happen!
    Mohammad Hamdy Ghanem
    @VBAndCs
    As it is against logic of event handling
    Or if the method is declared in another class , where i need to supply the class name
    In the last case, i cant imagine that the method is an instance method of the other class as it also defies the logic
    So, the only possible case is anotherclass.method where method is shared
    In short: vb nad c# in all cases must only allow method and otherclass.method
    Mohammad Hamdy Ghanem
    @VBAndCs
    The current behaviour defies logic.
    Adam Speight
    @AdamSpeight2008
    @CyrusNajmabadi @DualBrain I am just experimenting in my own fork.