Android Question Is named parameters supported in B4A?

Discussion in 'Android Questions' started by lightay, Apr 5, 2015.

  1. lightay

    lightay Member Licensed User

    Named Parameters helps make the code easier to understand. Is this feature supported in B4A? If not, could it be a feature request?
     
  2. DonManfred

    DonManfred Expert Licensed User

    What exactly you want to do?
    Maybe i did not understand correctly what the question is.
    But i´m sure there is a answer for it :)
     
  3. lightay

    lightay Member Licensed User

    http://en.wikipedia.org/wiki/Named_parameter

    An example of named parameters

    Without named parameters,
    Code:
    MyFunctionCall(20501005TRUE );
    With named parameters,
    Code:
    MyFunctionCall({ xPosition: 20, yPosition: 50, width: 100, height: 5,
    drawingNow: 
    true });
     
    Last edited: Apr 5, 2015
  4. Erel

    Erel Administrator Staff Member Licensed User

    Named parameters are not supported. You can make a feature request in the wishlist forum for this.

    While it is not really useful in this case I will still mention that the code you posted can be translated to:
    Code:
    MyFunctionCall(CreateMap("xPosition"20"yPosition"50, ...))

    Sub MyFunctionCall(params As Map)
     
  5. DonManfred

    DonManfred Expert Licensed User

    That was my first thought too but i decided do ask what he really want
     
  6. lightay

    lightay Member Licensed User

    Thanks for all your suggestions. But the code is still more readable with named parameters.
     
  7. NeoTechni

    NeoTechni Well-Known Member Licensed User

    I'd rather it tell us which parameter we are currently editing. VB6 shows it in bold in the tooltiptext for example. Its hard to keep track when you have a lot of parameters.

    Maybe even a way to keep a lot of the same function calls tableized into columns for neat code
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    See this (0:30):

     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice