Announcement

Collapse
No announcement yet.

Warning about Early Binding

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Please see:

    http://msdn.microsoft.com/en-us/libr...6b(VS.71).aspx


    Note: Another way to define a procedure with optional arguments is to use overloading. If you have one optional argument, you can define two overloaded versions of the procedure, one with the argument and one without it.
    tenholde

    Comment


      #17
      Originally posted by tenholde View Post
      I am now truly confused by the response to this issue.

      Method overloading can be used for both differing argument type and count.
      I believe the problem is that they absolutely have to make the two last options for hs.Run optional for some reason.

      And in .NET this can't be done:
      Sub Run(byval scriptname as String)
      [...]
      End Sub

      Sub Run(byval scriptname as String, Byval optional wait as Boolean = False, byval optional single_instance as Boolean = False)
      [...]
      End Sub

      But I don't see the problem, as this is perfectly legal:
      Sub Run(byval scriptname as String)
      [...]
      End Sub

      Sub Run(byval scriptname as String, Byval wait as Boolean, byval single_instance as Boolean)
      [...]
      End Sub
      It's not a problem at all in my head. Just force the users of the last overload Run to specify both arguments. This is new anyway, so there should not be any compability issues with that. Problem solved!
      HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
      Running on Windows 10 (64) virtualized
      on ESXi (Fujitsu Primergy TX150 S8).
      WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

      Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

      Comment


        #18
        You don't have to use optional parameters at all. You can just define each combination of parameters in multiple overloads. A little extra work for the developer, saves many headaches for the customers.

        tenholde
        tenholde

        Comment


          #19
          Everyone,

          thanks for your responses and inputs. I think we have shed some light on this issue and provided HST with an alternative to optional parameters.

          I hope they will give this a try next time they want to extend an existing method.

          I would think from a documentation standpoint overloads would also be better because hs wouldn't have 2,3,4 methods with different names basically doing the same thing
          Mark

          HS3 Pro 4.2.19.5
          Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
          Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
          Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

          Comment


            #20
            This is why I prefer to program in VHDL or ASM.

            'course, I can see where it might take me a bit longer to do the same thing other people are doing

            I just find it interesting, when I program in VB, I have to write out what I want the "thing" to do, then look up all the function names. I guess I should get tenholde's stuff up and running...but I am a notepad kind of guy... I think the highest level of programming that I really enjoyed was C, when I wrote my own OS. When I get to C++ or anything like VB...for me, my personal opinion, the Objects tend to get in the way. BUT, I have used them and programmed in them...I just don't prefer it!

            :-)

            --Dan
            Last edited by drozwood90; March 11, 2010, 01:59 PM. Reason: Added Link to Image
            Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

            Comment


              #21
              One last question,

              Will the overloads work ok if someone accesses the HS API with C# or C++?

              Both languages support overloads so it would seemm logical that they could call an overloaded method written in vb.net
              Mark

              HS3 Pro 4.2.19.5
              Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
              Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
              Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

              Comment


                #22
                Originally posted by drozwood90 View Post
                This is why I prefer to program in VHDL or ASM.

                I guess I should get tenholde's stuff up and running...but I am a notepad kind of guy...
                --Dan

                try it, you'll like it.
                tenholde

                Comment


                  #23
                  Just reading through this thread, I couldn't agree more with the overloading. I was almost ready to hit replay and say YES you can, you just don't make it optional that way you add a second method with the extra parameters.

                  This also got me thinking about the future.

                  Named parameters are supported in .net 4, so maybe the next version of homeseer could take advantage of optional parameters in a little bit more efficient way. You could have multiple optional parameters if you do it that way, and specify them in any order you want.
                  Joe (zimmer62)

                  BLSecurtiy, AC-RF2, RCS Serial Thermostats, RFXCOM SMarthome SwitchLinc, mcsXap, Global Cache GC100, SqueezeBox, TWA_ONKYOINTEGRA, BLLogMonitor, BLPlugins, BLRadar, BLSpeech, BLZLog.aspx, HSTouch (Windows, iPhone, iPod), USB Mimo touchscreens, VMWare Server, Vortexbox, Windows Home Server, MyMovies, Windows Media Center, X10, ZWave, and much much much more.

                  Comment


                    #24
                    Part of the reason, you have to remember, is that HomeSeer is 10 years old and there is a LOT of legacy code in there. The only way we could do it years ago was to create a separate procedure, and Microsoft's defacto standard for that was to add an "Ex" to the end of the procedure name that it is modeled after. Fast forward many years, and it was only last year that we started to get some serious requests for overloading rather than optional parameters - Mark had requested it but with nobody else asking and not much in the way of new development happening, AND still being on an older version of Visual Studio, we left things as it was. Now, VS2008 changed a little bit about how overloading is done, and with each year we move farther away from COM based interfaces (such as the VBScript currently supported by HomeSeer) and so it is more feasible to do overloading without breaking anything. As such, in creating HS3 and wanting to have previous procedures still work while moving to new ones, I have done a LOT of overloading. So, it is coming now - it is not that we did not want to do it, it was that there were some small issues in doing it pertaining to some of the older technologies still being supported to interface with HomeSeer and the development environment.

                    We still cannot overload a procedure when the parameter types are the same, and for some procedures that DOES make it quite difficult. In fact, there are some overloads that have some parameters required to be provided when normally they would not be, just so the prototype for the overload would appear different from the others.
                    Regards,

                    Rick Tinker (a.k.a. "Tink")

                    Comment

                    Working...
                    X