Board index » delphi » Declare variables at runtime??

Declare variables at runtime??

Hi Delphi-Folks

Is it possibly to declare some variables
at runtime? (while the program is running??)..

Please give me an example...

Thanks for your help...

Greetings from Roli, Switzerland    chip.informa...@bluewin.ch

 

Re:Declare variables at runtime??


Hi,

I don't think you can declare variables at run time. You have to understand
the philosophy of a strong typed language like Pascal. If you declare a
variable, it is for the compiler to check if the processing you do with
that variable is conform to the variable type. So what could be the meaning
and purpose of a declaration at run time ? The compiler is not involved any
more !

To do this kind of thing, you need to use a not typed language like
SmallTalk. In this type of language the compiler doesn't try to catch your
type errors. You are on your own !

In most cases, except perhaps AI systems, a strongly typed language is
better and more safe.

In Delphi you can still bypass all this by declaring pointers (not typed)
and then create dynamically variables on the heap. Good luck. i am not an
expert is this, look at function like NEW, DISPOSE, POINTER and alike.

I don't know what you want to accomplish but you can probably do it the
simple way

Jean-Marie GALLIOT
jm.gall...@canis.net

Roland Hartmann <chip.informa...@bluewin.ch> wrote in article
<33A0E0EE.4...@bluewin.ch>...

Quote
> Hi Delphi-Folks

> Is it possibly to declare some variables
> at runtime? (while the program is running??)..

> Please give me an example...

> Thanks for your help...

> Greetings from Roli, Switzerland    chip.informa...@bluewin.ch

Re:Declare variables at runtime??


On Fri, 13 Jun 1997 07:55:58 +0200, Roland Hartmann

Quote
<chip.informa...@bluewin.ch> wrote:
>Hi Delphi-Folks

>Is it possibly to declare some variables
>at runtime? (while the program is running??)..

What do you actually mean?
Or what are you trying to do?

Geir

--
Geir Tutturen
geir.tuttu...@itf.nlh.no
(use this address (the return address is a spam avoiding fake))

Other Threads