Register | Login
Forum Index > Requests and Feedback > Procedure type in procedure parameters
Author Message
Pages: 1 2
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1774] - posted: 2015-02-23 13:54:57
Functions must have a return type declared.
But currently we cannot write:
Code:
function  X() {
  function* MyProc() : sysword;
  if (MyProc() > 0) {}
  return true;
}
only allowed:
Code:
function  X() {
  function* MyProc() : sysword;
  gp_ax = MyProc();
  if (gp_ax > 0) {}
  return true;
}

And in this case type of 'gp_ax' used.
Also in usual functions we did not write type of them.

But if we really will use type of function then it of course good idea smile
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1785] - posted: 2015-02-23 22:39:59
I have been considering options of adding types to functions using a similar C like syntax, but this is on my "undecided" list for now.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1787] - posted: 2015-02-24 10:25:34
It is possible to do it by analogy with:
Code:
function* MyProc() : sysword;
i.e. by this way:
Code:
function MyProc() : sysword; {
  sysword tmp;
// ..............  
  return tmp;
}
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1790] - posted: 2015-02-24 11:31:50
I thought about this way, but I was uncomfortable with the syntax

Code:
type; {


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1791] - posted: 2015-02-24 11:34:36
Options are:

1. Code:
function WINAPI MyProc(par1, par2, par3): sysword {
  //
}


2. Code:
function WINAPI MyProc: sysword(par1, par2, par3) {
  //
}


3. Code:
function WINAPI sysword MyProc(par1, par2, par3) {
  //
}


4. Code:
// c-type (not really suitable as i planned to use this format for very high level functions)
sysword WINAPI MyProc(par1, par2, par3) {
  //
}


5. Code:
sysword MyProc = WINAPI function(par1, par2, par3) {
  //
}


6. Code:
function WINAPI MyProc(par1, par2, par3) {
  //
}: sysword;


7. Code:
function:sysword WINAPI MyProc(par1, par2, par3) {
  //
}


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1792] - posted: 2015-02-24 12:38:37
As for me then #1 and #6 seems are good variants.
But advantage of #1 that we can distinguish type at the beginning of function.

Also i would like to pay attention that if we will add in future some other parameter then we maybe need to use semicolon. Like this:
Code:
function WINAPI MyProc(par1, par2, par3) : sysword; forward; noframe; some_other_param; ...; ...; ...; {
  //
}
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1793] - posted: 2015-02-25 13:22:18
OK maybe I will give it a try this way and see how it goes. I've added [post 1792] type #1 to my todo list.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1798] - posted: 2015-02-26 23:42:22
This is implemented for next release.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1 2
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 8 user(s) online. 0 member(s) and 8 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd