473,698 Members | 2,923 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically typed

Why scripting languages are dynamically and weakly typed? and why none
of the scripting languages is compiler based?
why cant a scripting language be use like java or c++ where we can
catch type errors e.g. (string being assigned to an integer),
parameter passing at compiled time.
what is the significance of multiple dollar sign ($$...$var) in php?
e.g.
$var = "profession ";
$$var = "doctor";
$$$var = "khalid";
and so on...

May 17 '06 #1
4 1391
munna wrote:
Why scripting languages are dynamically and weakly typed? and why none
of the scripting languages is compiler based?
why cant a scripting language be use like java or c++ where we can
catch type errors e.g. (string being assigned to an integer),
parameter passing at compiled time.
what is the significance of multiple dollar sign ($$...$var) in php?
e.g.
$var = "profession ";
$$var = "doctor";
$$$var = "khalid";
and so on...


Why do I always end up in a trafficjam if I take the car?
Why do I browse this newsgroup, and answer this question while your negative
attitude irritates me a little?
Why do I always end up with a hangover if I drink a lot?
and so on...

To your 'questions':

- PHP juggles types around to make things easier, at least that was the
intent of the builders.
If you don't like loose typed variables, cast them to something you DO like
when you use them.
$someVar = "12.3";
now $someVar is a string, however, if you use it like:
$summed = 12 + $someVar;
it will be interpreted as a float.

So if you want your variables strongtyped, pick another language or cast
them always before using.

Start here: http://nl3.php.net/manual/en/langref.php
Read at least that whole chapter (Language reference) before asking basic
questions.

About the $ sign, it is a substitutemetho d for variable-adressing.
$var = "profession ";

// Simple: Now $var contains a String.

$$var = "doctor";

Now you created a variable named $profession with value "doctor".
$$$var = "khalid";

No clue, probably more of the same.
I never use such strange languageconstru cts.

Regards,
Erwin Moller
May 17 '06 #2
Erwin Moller wrote:
Why do I always end up with a hangover if I drink a lot?
and so on...


The problem, you see, is that beverages aren't strongly typed. You can
pass vodka to your month just as easier as water. So people end up
getting serious runtime errors at parties, football matches, and such,
when they inadvertently drink the wrong substance.

May 17 '06 #3
On 2006-05-17, munna <ha********@gma il.com> wrote:
Why scripting languages are dynamically and weakly typed? and why none
of the scripting languages is compiler based?
In my experience there is no good definition for 'scripting language'
and thus is making the distinction between 'programming language' and
'scripting language' useless.
why cant a scripting language be use like java or c++ where we can
catch type errors e.g. (string being assigned to an integer),
parameter passing at compiled time.
Actually there are programming languages (which you would name
'scripting languages) that support this.

Even PHP5 supports this feature (be it limited to custom classes though...)

what is the significance of multiple dollar sign ($$...$var) in php?


rtfm (section on variable variables)

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be >
May 17 '06 #4
I think those people explicitly want to support the DrinkableLiquid
superclass instead of just the NonAlcoholic subclass ;)

Chung Leong wrote:
Erwin Moller wrote:
Why do I always end up with a hangover if I drink a lot?
and so on...


The problem, you see, is that beverages aren't strongly typed. You can
pass vodka to your month just as easier as water. So people end up
getting serious runtime errors at parties, football matches, and such,
when they inadvertently drink the wrong substance.

May 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
8305
by: Laura | last post by:
Hello, Newbie question: Does anyone know how to dynamically set the screen width in an applet? I have an applet that creates a horizontal bar menu on a webpage, and I would like the width to be 100%. Unfortunately, this doesn't work with Explorer. so, in my html page, I wrote a function like this: <SCRIPT LANGUAGE="JavaScript"> int function getScreenWidth()
3
1722
by: The Pritchard | last post by:
I want the user to be able to save the information displayed on a dynamically created page. When I write a script like the following: <SCRIPT> winNew = window.open("","test"); winNew.document.writeln("Hello World!"); winNew.document.close(); winNew.focus();
2
7586
by: Laura | last post by:
In C#, the method was dynamically invoked through reflection. But How do we dynamically cast the return object to its own type? Here is the sample code: // dynamically invoke the method Object obj = mi.Invoke(null, null); // get the type of the returned object Type MyType = obj.GetType();
1
7265
by: Mohan | last post by:
Hi, In my application, I need to increase the 2-dimensional array size dynamically. Please let me know the procedure to declare a dynamic 2-dimensional array like Single dimensional array, ArrayList. Thanks, Mohan
1
1475
by: Mike | last post by:
I have a placeholder object in which I am dynamically placing controls based on a database query. Of course during postback these controls go away. I have seen other questions posed where someone wants the dynamically created controls to appear on the page. However in my case I don't really need to have the control displayed after postback, but I do need its value. When I look at the trace output from the page after postback, it lists the value...
2
2908
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to avoid the problem by avoiding the table control or resorting to databound controls that better manage state for me. I hope to understand how to solve the problem by using the Table web control and sticking to the approach of building the table at run...
7
6783
by: pmclinn | last post by:
I was wondering if it is possible to dynamically create a structure. Something like this: public sub main sql = "Select Col1, Col2 from Table a" dim al as new arraylist al = LoadOracleData(sql) '____Do amazing things
4
10454
by: puzzlecracker | last post by:
I have seen these terms used in Gang of 4 but could never thoroughly understand what it meant I perceive that C++ is both, but apparently it is only a latter. Can someone explain it? thx
4
1558
by: Gazarsgo | last post by:
This seems to be a bit of a contradiction, but how can I construct a Generic class using a System.Type variable that is assigned at run time? Is there some parallel to the Generics concept that extends to having strictly-typed classes at run-time? I would gladly give up the compile-time errors if I could get rid of all these CType()s :)
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9170
Oralloy
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...
1
8902
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,...
0
8873
tracyyun
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...
1
6528
isladogs
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...
0
4623
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
2
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.