Does C++ support dynamic programming? I hope I'm using the correct
term. I want to write code that can dynamically rewrite itself! I want
to dynamically create functions and call them and etc. If not, are
there any plans to add support for it in the future? What other
popular programming languages support dynamic programming? [Email me
privately for the last question so that people will not complain that
it's out of context.]
--The Directive 5 2958
"The Directive" <th***********@ hotmail.com> wrote in message
news:84******** *************** ***@posting.goo gle.com Does C++ support dynamic programming? I hope I'm using the correct term. I want to write code that can dynamically rewrite itself! I want to dynamically create functions and call them and etc. If not, are there any plans to add support for it in the future? What other popular programming languages support dynamic programming? [Email me privately for the last question so that people will not complain that it's out of context.]
If you mean does C++ allow you to generate functions on the fly that are
identical to those produced at compile time, then the answer is no. C++ can,
however, be used to create an interpreter, i.e., a program that will allow
you to type in functions at runtime and will store and execute those
functions. Writing such a program involves some work, however (how much work
depends on the range of possible functions you wish to support).
Any function that you might write will be built up from basic operations
(built in operators like + as well as predefined functions like sin and
cos). Accordingly, an interpreter basically consists of a pre-written
all-purpose function that calls basic operations as needed by the function
that the user specifies at run-time (in the simplest case, it may involve a
switch statement that executes different operations depending on which
operation has been specified at run-time). For a simple illustration of how
this is done, look at the calculator program in Ch 6 (including exercise 20)
of Stroustrup's TC++PL.
--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)
"John Carson" <do***********@ datafast.net.au > wrote in message
news:40******** @usenet.per.par adox.net.au... "The Directive" <th***********@ hotmail.com> wrote in message news:84******** *************** ***@posting.goo gle.com Does C++ support dynamic programming? I hope I'm using the correct term. I want to write code that can dynamically rewrite itself! I want to dynamically create functions and call them and etc. If not, are there any plans to add support for it in the future? What other popular programming languages support dynamic programming? [Email me privately for the last question so that people will not complain that it's out of context.]
If you mean does C++ allow you to generate functions on the fly that are identical to those produced at compile time, then the answer is no. C++ can, however, be used to create an interpreter, i.e., a program that will allow you to type in functions at runtime and will store and execute those functions. Writing such a program involves some work, however (how much work depends on the range of possible functions you wish to support).
Well , C++ can generate class hierarchies on the fly.
That means you can make the compiler generate it for you.
This involves using templates.
Take a look at Andrei Alexandrescu's "Modern C++ design" where he shows in
chapter 4 how to
generate linear and scattered class hierarchies at compile time.
Best wishes,
Sharad
Sharad Kala wrote: Take a look at Andrei Alexandrescu's "Modern C++ design" where he shows in chapter 4 how to generate linear and scattered class hierarchies at compile time.
^^^^^^^^^^^^^^^
"Compile time" may or may not meet your definition of dynamic
programming, because it involves a compile/execute/modify-source loop.
It doesn't happen on what most people consider to be "the fly".
Jacques.
"Jacques Labuschagne" <ja*****@clawsh rimp.com> wrote in message
news:ss******** ************@ne ws02.tsnz.net.. . Sharad Kala wrote: Take a look at Andrei Alexandrescu's "Modern C++ design" where he shows in chapter 4 how to generate linear and scattered class hierarchies at compile time. ^^^^^^^^^^^^^^^ "Compile time" may or may not meet your definition of dynamic programming, because it involves a compile/execute/modify-source loop. It doesn't happen on what most people consider to be "the fly".
Yes..actually I do agree with you that it isn't exactly what people would say
dynamic programming.
In fact it uses static polymorphism.
My point was that you can make C++ to write code for you. This is unlike virtual
functions where the branch of execution to be selected
is dynamic, but the code for execution has already been hand-written by someone.
Best wishes,
Sharad
The Directive wrote: Does C++ support dynamic programming? I hope I'm using the correct term. I want to write code that can dynamically rewrite itself! I want to dynamically create functions and call them and etc. If not, are there any plans to add support for it in the future? What other popular programming languages support dynamic programming? [Email me
your problem might be resolved using embeddable C/C++ interpreter Ch. It
allows you to generate C/C++ code source code/functions on the fly and
be called by your C/C++ binary application, or call back your binary
C/C++ functions.
you can take a look at
http://www.softintegra tion.com/solution/embedded/
http://www.softintegra tion.com/products/sdk/embedded_ch/
privately for the last question so that people will not complain that it's out of context.]
--The Directive This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Roel Wuyts |
last post by:
CALL FOR CONTRIBUTIONS
International Workshop on Revival of Dynamic Languages
http://pico.vub.ac.be/~wdmeuter/RDL04/index.html
(at OOPSLA2004, Vancouver, British Columbia, Canada, October 24-28, 200)
Organization committee:
Roel Wuyts (primary contact - roel.wuyts@ulb.ac.be), Gilad Bracha,
Wolfgang De Meuter, Stéphane Ducasse and Oscar Nierstrasz.
|
by: Neuruss |
last post by:
I've been reading an article published in E-Week entitled "Microsoft
Lures Open-Source Programmer", which contains a definition for dynamic
languages as follows:
"Dynamic programming languages enable programs to change their
structure as they run."
I wonder if this definition is correct.
Can we define dynamic languages this way?
|
by: Leslaw Bieniasz |
last post by:
Cracow, 20.10.2004
Hello,
As far as I understand, the generic programming basically consists
in using templates for achieving a static polymorphism of the
various code fragments, and their reuse for various template
parameters. I wonder if there exist techniques for achieving
a dynamic polymorphism using the generic programming. Is this
possible? If yes, can anyone show me simple examples in C++
|
by: chris |
last post by:
Hi all,
I need to know, what is the difference between dynamic memory
allocation, and stack allocation ?
1. If I have a class named DestinationAddress, when should I use
dynamic memory allocation to create object of that class ?
2. If it says "dynamic memory allocation", is it mean the
following code :
DestinationAddress* dest = new DestinationAddress(); // code 1
|
by: Pascal Costanza |
last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monday, February 13, 2006, VUB Campus Etterbeek
The VUB (Programming Technology Lab, System and Software Engineering
Lab), ULB (deComp) and the Belgian Association for Dynamic Languages
(BADL) are very pleased to invite you to a whole day of presentations
about the programming languages Self, Smalltalk and Common Lisp by
experts in...
| |
by: alexandre.bergel |
last post by:
Dear colleges,
You might want to consider Dyla'07 as a good venue to present your
work and your favourite programming language.
Regards,
Alexandre
**************************************************************************
|
by: Guillermo Schwarz |
last post by:
C++ers,
I have programmed in C++ since 1991 and I probably created my best
abstraction layers in C++ in those days. Since 2001 I've been
programming in Java (at first against my will, then I realized the
market was moving into Java) and I'm trying to reimplement in Java
what I did back in those days.
The problem I have is that I have a job offer for programming in C++,
again!!!, and I don't know if I should take it. My problem is...
|
by: Tinku |
last post by:
Hi friends
I know Static Hashing and i know about Dynamic Hashing, still i have
problem to make program with Dynamic Hashing I am new in "C" world,
please help me, my problem is:
i have to make program in Dynamic hashing i have to store int value in
nodes user only enter int value by this value i have to find hash key
and make symbol table
my struct are
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |