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


Groups > comp.lang.javascript > #19904 > unrolled thread

Can somebody explain this short code

Started by"Tony" <tony.johansson@inport.com>
First post2013-05-23 12:01 +0200
Last post2013-05-23 10:16 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.javascript


Contents

  Can somebody explain this short code "Tony" <tony.johansson@inport.com> - 2013-05-23 12:01 +0200
    Re: Can somebody explain this short code tony@mountifield.org (Tony Mountifield) - 2013-05-23 10:16 +0000

#19904 — Can somebody explain this short code

From"Tony" <tony.johansson@inport.com>
Date2013-05-23 12:01 +0200
SubjectCan somebody explain this short code
Message-ID<knkp6o$sov$1@dont-email.me>
Note this code is autogenerated
What I don't understand is this
How is it possible to call function  dsFrsvoyage_ttFrsvoyage when the 
signature doesn't match.
The function  dsFrsvoyage_ttFrsvoyage doesn't any argument but you can call 
it with an argument.


function dsFrsvoyage()
{
    this.ttFrsvoyage = new Array(1);
    this.ttFrsvoyage[0] = new dsFrsvoyage_ttFrsvoyage(1);
}

function dsFrsvoyage_ttFrsvoyage()
{
    this.Vesselid = "";
    this.Arrtime = null;
    this.Deptime = null;
    this.Objecttype = "";
    this.Dnggoods = false;
    this.prevport = "";
    this.port = "";
    this.nextport = "";
    this.VoyNum = "";
    this.done = false;
    this.sent = "";
    this.todestination = "";
    this.fromdestination = "";
    this.Remark = "";
    this.errstat = "";
    this.cancelled = false;
    this.Sendstat = "";
    this.Objectid = 0;
    this.UID = "";
    this.UIDDATE = null;
    this.UIDTIME = "";
    this.UIDPGM = "";
    this.Z_Seq = 0;
    this.MISC1 = "";
    this.MISC2 = "";
    this.MISC3 = "";
    this.UIDsign = "";
    this.UIDupdate = null;
    this.UIDuppgm = "";
    this.UIDuptime = "";
}

//Tony 

[toc] | [next] | [standalone]


#19905

Fromtony@mountifield.org (Tony Mountifield)
Date2013-05-23 10:16 +0000
Message-ID<knkq9o$cnp$1@softins.clara.co.uk>
In reply to#19904
In article <knkp6o$sov$1@dont-email.me>,
Tony <tony.johansson@inport.com> wrote:
> Note this code is autogenerated
> What I don't understand is this
> How is it possible to call function  dsFrsvoyage_ttFrsvoyage when the 
> signature doesn't match.
> The function  dsFrsvoyage_ttFrsvoyage doesn't any argument but you can call 
> it with an argument.
> 
> 
> function dsFrsvoyage()
> {
>     this.ttFrsvoyage = new Array(1);
>     this.ttFrsvoyage[0] = new dsFrsvoyage_ttFrsvoyage(1);
> }
> 
> function dsFrsvoyage_ttFrsvoyage()
> {
>     this.Vesselid = "";
>     this.Arrtime = null;
>     this.Deptime = null;
>     this.Objecttype = "";
>     this.Dnggoods = false;
>     this.prevport = "";
>     this.port = "";
>     this.nextport = "";
>     this.VoyNum = "";
>     this.done = false;
>     this.sent = "";
>     this.todestination = "";
>     this.fromdestination = "";
>     this.Remark = "";
>     this.errstat = "";
>     this.cancelled = false;
>     this.Sendstat = "";
>     this.Objectid = 0;
>     this.UID = "";
>     this.UIDDATE = null;
>     this.UIDTIME = "";
>     this.UIDPGM = "";
>     this.Z_Seq = 0;
>     this.MISC1 = "";
>     this.MISC2 = "";
>     this.MISC3 = "";
>     this.UIDsign = "";
>     this.UIDupdate = null;
>     this.UIDuppgm = "";
>     this.UIDuptime = "";
> }

Yes, JS does not do any argument prototype checking, and you don't need
to name the parameters in the function definition.

The arguments are placed in an automagically-created object called arguments,
and then the elements are placed in any named parameters there might be.

function foo(a,b) {
	// a contains arguments[0]
	// b contains arguments[1]
	// further arguments are just in arguments[2] onwards.
}

foo(11,22,33,44); // a=arguments[0]=11, b=arguments[1]=22, arguments[2]=33, arguments[3]=44

Since in your example, the generated function doesn't use arguments[],
the 1 passed in is ignored.

> //Tony 

// Another Tony :)
-- 
Tony Mountifield
Work: tony@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web