Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12140

Re: Overload a system function like FormatDateTime with a user-defined one ?

From GS <gs@v.invalid>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Overload a system function like FormatDateTime with a user-defined one ?
Date 2019-05-10 14:06 -0400
Organization A noiseless patient Spider
Message-ID <qb4ek4$qp5$1@dont-email.me> (permalink)
References (3 earlier) <qb1rp7$438$1@dont-email.me> <qb38eh$1i4i$1@gioia.aioe.org> <qb3rme$5et$1@dont-email.me> <qb47sb$342$1@gioia.aioe.org> <qb4c2p$a5o$1@dont-email.me>

Show all headers | View raw


> "R.Wieser" <address@not.available> wrote
>
>> But to give an example:
>> FormatDateTime(date, value) 'system function
>> FormatDateTime(date, formatting string) 'my function
>> 
>
>   I guess I don't get it. Overloading would be to
> have one function work differently depending on
> parameters. You're just asking if you can use
> an existing keyword or function name and somehow
> hope that WSH doesn't notice. 

Overloading in the current C languages supports multiple methods with the same 
name but different parameters; - which combo of params you use determines which 
version the compiler uses.

I've been doing similar in VB_ projects for years by passing an action index to 
a single function to tell it what to do; - the function may also have other 
args but the only one I use for Format_DateTime() is an index to tell it which 
date or time format to return.

I'm in the process of converting all my stuff to C# and so far all is going 
well. While it's possible to convert my multi-task functions to overloaded 
ones, I don't yet see their point (other than to simplify naming and persist 
further support of unnecessary bloating)! Single multi-task functions use 
'Case' branching for actions to take for a common purpose. For example, my 
GetInfo_FromWMI() function contains all the code necessary for all the various 
WMI queries I use for my licensing methodology to return a delimited string for 
a license profile MachineID property consisting of:

   Make, Model, Mainboard SerialNumber,BIOS SerialNumber

The process involves using GoTo statements to control the order the info is 
collected from the various WMI classes when the 'Case' statements don't 
necessarily follow any order. This has been working well for 15+ years and so I 
don't see any point in 'breaking' it just because the .NET Framework supports 
the 'new and improved' feature of method overloading.

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-09 09:23 +0200
  Re: Overload a system function like FormatDateTime with a user-defined one ? GS <gs@v.invalid> - 2019-05-09 05:20 -0400
    Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-09 11:44 +0200
      Re: Overload a system function like FormatDateTime with a user-defined one ? GS <gs@v.invalid> - 2019-05-09 14:33 -0400
        Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-10 09:15 +0200
          Re: Overload a system function like FormatDateTime with a user-defined one ? "Mayayana" <mayayana@invalid.nospam> - 2019-05-10 08:41 -0400
            Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-10 18:11 +0200
              Re: Overload a system function like FormatDateTime with a user-defined one ? GS <gs@v.invalid> - 2019-05-10 13:13 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-10 20:57 +0200
                Re: Overload a system function like FormatDateTime with a user-defined one ? GS <gs@v.invalid> - 2019-05-10 15:23 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-11 09:39 +0200
                Re: Overload a system function like FormatDateTime with a user-defined one ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-11 11:31 +0200
                Re: Overload a system function like FormatDateTime with a user-defined one ? "Mayayana" <mayayana@invalid.nospam> - 2019-05-11 06:59 -0400
              Re: Overload a system function like FormatDateTime with a user-defined one ? "Mayayana" <mayayana@invalid.nospam> - 2019-05-10 13:21 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? GS <gs@v.invalid> - 2019-05-10 14:06 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-10 20:52 +0200
                Re: Overload a system function like FormatDateTime with a user-defined one ? "Mayayana" <mayayana@invalid.nospam> - 2019-05-10 15:45 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? GS <gs@v.invalid> - 2019-05-10 15:53 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-11 09:59 +0200
                Re: Overload a system function like FormatDateTime with a user-defined one ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-11 11:31 +0200
                Re: Overload a system function like FormatDateTime with a user-defined one ? GS <gs@v.invalid> - 2019-05-11 14:47 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? GS <gs@v.invalid> - 2019-05-11 14:56 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-11 22:19 +0200
                Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-12 09:24 +0200
                Re: Overload a system function like FormatDateTime with a user-defined one ? "Mayayana" <mayayana@invalid.nospam> - 2019-05-11 16:36 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? GS <gs@v.invalid> - 2019-05-11 17:55 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-11 11:12 +0200
                Re: Overload a system function like FormatDateTime with a user-defined one ? "Mayayana" <mayayana@invalid.nospam> - 2019-05-11 07:49 -0400
                Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-11 15:12 +0200
                Re: Overload a system function like FormatDateTime with a user-defined one ? "R.Wieser" <address@not.available> - 2019-05-10 20:46 +0200
          Re: Overload a system function like FormatDateTime with a user-defined one ? GS <gs@v.invalid> - 2019-05-10 13:28 -0400
  Re: Overload a system function like FormatDateTime with a user-defined one ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-09 11:39 +0200

csiph-web