SRL Archive - Suggestions

Ability to use types for constants


Shuttleu

2010-08-31 17:22:29

just like the title says

so for example,
you can have a TBox constant
or a TPoint constant

~shut

Shuttleu

2010-09-01 15:50:29

thoughts anyone?

~shut

Frement

2010-09-01 15:55:06

Does the interpreter allow this?

Gu3st...

2010-09-01 16:42:17

For those that find this unclear:
const
MyBox = 123, 123, 345, 345;
MyPoint = 24, 52;

Would be cool if it's allowed

Blumblebee

2010-09-01 16:49:42

difference from

MMx1
MMy1
MMx2
MMy2

?

aside from saving 4 lines.

Frement

2010-09-01 16:51:20

I really don't think this is possible, and as constants can't take functions, I don't see anyway this could be done.

Shuttleu

2010-09-01 17:26:50

From: Blumblebee
difference from

MMx1
MMy1
MMx2
MMy2

?

aside from saving 4 lines.


writing

const
MyBox = 12, 34, 43, 56;

MeIsInBox(MyBox);
is easier and faster to type and easier to understand than

const
MyBoxX1 = 12;
MyBoxY1 = 34;
MyBoxX2 = 43;
MyBoxY2 = 56;

MeIsInBox(IntToBox(MyBoxX1, MyBoxY1, MyBoxX2, MyBoxY2);

see? :)

~shut

Nava2

2010-09-01 18:03:08

Python can do this! :D

nielsie95

2010-09-02 13:35:43

Pascal can do this too, but the interpreter doesn't support it. I believe Sepi does, though.

Shuttleu

2010-09-02 15:37:59

From: nielsie95
Pascal can do this too, but the interpreter doesn't support it. I believe Sepi does, though.


didnt i hear somewhere that you might be switching to sepi?

~shut

nielsie95

2010-09-02 16:30:59

It's highly unlikely that we will port Sepi to FPC, so don't count on it :(

Daniel

2010-09-03 02:04:39

From: nielsie95
It's highly unlikely that we will port Sepi to FPC, so don't count on it :(


:(. If I had FPC, I'd help.

Wizzup?

2010-09-03 04:15:37

[QUOTE=Dan's The Man;734589]:(. If I had FPC, I'd help.

http://villavu.com/forum/showthread.php?t=58000