Given that UNIX, including networking, is almost entirely coded in C,
how come so many things are almost impossible in ordinary C? Examples:
Network and internet access, access to UNIX interprocess controls and
communication, locale determination, EBCDIC/ASCII discrimination, etc.
Almost all of these are easy in Perl. Why isn't there a mechanism like
perl modules to allow easy extentions for facilities like these? Isn't
anyone working on this problem? or is it all being left for proprietary
systems?
Sep 2 '08
223 7318
On 10 Sep, 20:42, Flash Gordon <s...@flash-gordon.me.ukwro te:
jacob navia wrote, On 10/09/08 07:53:
<snip>
This is why many languages use operator overloading!
It is much simpler to read and use.
It can make some things easier to write, and with sufficient discipline
it can be very useful. However, in general you don't know whether
sufficient discipline has been used. With operator overloading tell me
what the following line does...
* * count = a - b;
Bet you got it wrong, a and b are set types,
and in well written code the definitions of a and b
wouldn't be far away. Hence I'd glance to the top of page
and find
SetType a;
SetType b;
which would warn me (even if I didn't know what SetType
meant) that there was something unusual going on with '-'
(at least).
- is overloaded to provide
the intersection, and = is overloaded so that if the left operand is an
integer types and the right a set type it assigns the cardinality of the
set to the left operand. So count will be the number of elements in both
a and b.
Now, is the following easier to read?
* * count = card(intersect( a,b));
- for set intersection is common mathematical notation
--
Nick Keighley
In a sense, there is no such thing as a random number;
for example, is 2 a random number?
(D.E.Knuth)
On 12 Sep, 09:06, Nick Keighley <nick_keighley_ nos...@hotmail. com>
wrote:
On 10 Sep, 20:42, Flash Gordon <s...@flash-gordon.me.ukwro te:
jacob navia wrote, On 10/09/08 07:53:
<snip>
This is why many languages use operator overloading!
It is much simpler to read and use.
It can make some things easier to write, and with sufficient discipline
it can be very useful. However, in general you don't know whether
sufficient discipline has been used. With operator overloading tell me
what the following line does...
* * count = a - b;
Bet you got it wrong, a and b are set types,
and in well written code the definitions of a and b
wouldn't be far away. Hence I'd glance to the top of page
and find
SetType a;
SetType b;
which would warn me (even if I didn't know what SetType
meant) that there was something unusual going on with '-'
(at least).
- is overloaded to provide
the intersection, and = is overloaded so that if the left operand is an
integer types and the right a set type it assigns the cardinality of the
set to the left operand. So count will be the number of elements in both
a and b.
Now, is the following easier to read?
* * count = card(intersect( a,b));
- for set intersection is common mathematical notation
this is, of course, bollocks. - is sensible mathematical set
notation, but not intersection. A while since I played with
sets
--
Nick Keighley
Nick Keighley wrote, On 12/09/08 09:12:
On 12 Sep, 09:06, Nick Keighley <nick_keighley_ nos...@hotmail. com>
wrote:
>On 10 Sep, 20:42, Flash Gordon <s...@flash-gordon.me.ukwro te:
>>jacob navia wrote, On 10/09/08 07:53:
<snip>
>>>This is why many languages use operator overloading! It is much simpler to read and use. It can make some things easier to write, and with sufficient discipline it can be very useful. However, in general you don't know whether sufficient discipline has been used. With operator overloading tell me what the following line does... count = a - b; Bet you got it wrong, a and b are set types,
and in well written code the definitions of a and b wouldn't be far away. Hence I'd glance to the top of page and find
SetType a; SetType b;
which would warn me (even if I didn't know what SetType meant) that there was something unusual going on with '-' (at least).
With well written code I agree. The problem is I also have to deal with
badly written code.
>>- is overloaded to provide the intersection, and = is overloaded so that if the left operand is an integer types and the right a set type it assigns the cardinality of the set to the left operand. So count will be the number of elements in both a and b. Now, is the following easier to read? count = card(intersect( a,b));
- for set intersection is common mathematical notation
this is, of course, bollocks. - is sensible mathematical set
notation, but not intersection. A while since I played with
sets
I'm sure someone will make that mistake when using operator overloading
to implement sets, just as both of us have now done ;-)
Many moons ago I did a lot of work using sets in Pascal, I just
miss-remembered it. With that Pascal code using * for intersection etc
was not a problem because the code was well written, after all I wrote
it ;-)
Operator overloading can be used to very good effect. However, for those
of us having to deal with code written by people we have no control over
and who abuse language features it would make reading the code more
complex because of the need to check.
--
Flash Gordon
Ian Collins wrote, On 12/09/08 03:32:
Flash Gordon wrote:
>Ian Collins wrote, On 11/09/08 20:38:
>>Ian Collins wrote: Flash Gordon wrote: s0****@gmail.co m wrote, On 11/09/08 11:38: >There are a couple of important factors you're overlooking: You are missing the point that lots of us have to deal with code written by other people who do not necessarily follow good practice. > If you are going to use that argument, you may as well ban pointers as well.
I should have said macros there. While maintaining other people's code I've had more arse ache form stupid macros then I've ever had from overloaded operators.
If I was creating my ideal language it would not have macros, they make the language more complex. However, that boat sailed a long time ago in C. Anyway, I'm arguing that operator overloading is an additional complexity and because of that it is unlikely to be added to C.
I can't argue with with it not being added to C, but having used
operator overloaded a lot in that other language, I still believe the
benefits more than outweigh any cost.
I agree that it can be used well. Where I used to work we could impose
appropriate disciplines to remove the abuses, and if I remember your
posting history correctly I suspect the same applies to where you work.
However, with one developer I know I can just imagine the mess he could
create since I know the mess he can create just with C as it is.
The last large project I working on had a lot of time types and
complicated periodic fixed or variable duration control processes. Most
of the time when working with times, the type of the time interval or
period was irrelevant. Having overloaded operators provided a
convenient level of abstraction enabling us to concentrate on the
problem, not the detail of the implementation.
Agreed.
You accept there is a cost, I accept there is a value.
--
Flash Gordon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dpackwood |
last post by:
Hello,
I have two different scripts that do pretty much the same thing. The main
perl script is on Windows. It runs and in the middle of it, it then calls
out another perl script that then should run on a Unix box I have. Both
scripts run ok, except for the part when Windows try's to call out the
Unix script. I have it set up where the Unix is mapped through a drive
letter and can drop stuff into the Unix box. It is going through another...
|
by: Mohsin |
last post by:
Hi all,
I have a perl program which makes a user exit to the O/S (unix, solaris)
to issue a O/S command. I know that the shell it invokes is NOT a
korn shell, because I captured the shell info into a file with a
'ps' command. My question is "How to explicitly specify a Korn shell to
be used by perl?"
Eg of my perl code:
## Begin code snippet..
|
by: Danny Jensen |
last post by:
I need to test if certain processes on a unix box were running. I
wanted to use whatsup gold to do the testing. First I needed to go to
the whatsup configure>monitors & services menu to add this tcp/ip port
1555 service with the folowing lines:
Send=psef /dj/myco/rf.monitor\r\n
Expect=~1
the psef above is a command that the unix server executes. The unix
box communicates back a 1 if the test is successful and a 0 if it is
|
by: Al Belden |
last post by:
Hi all,
I've been working on a problem that I thought might be of interest: I'm
trying to replace some korn shell scripts that search source code files with
perl scripts to gain certain features such as:
More powerful regular expressions available in perl
Ability to print out lines before and after matches (gnu grep supports this
but is not availble on our Digital Unix and AIX platforms)
Make searches case insensitive by default (yes, I...
|
by: asimorio |
last post by:
Hi folks,
Recently, I am investigatin a memory leak issue.
I have written a simple C++ program and a Perl script to test on UNIX
environment machine.
I do a for loop to new up 20 char of size 32768 bytes, then delete
them. Please see below:
//// part of the code start ////
for (i=0; i<20; i++) {
ptrA = new (std::nothrow) char;
| |
by: perlnewbie |
last post by:
Hi everyone I am new to perl and I am writing a perl script to invoke a set of commands on UNIX clearcase vob however I am having trouble after setting the view and mounting the vob I want to change the directory into the vob and then using Cwd or pwd to confirm I am in the vob to continue the CC functions.
Sample code in perl :
$Result = system 'cleartool setview admin_view';
$Result = system ('cleartool mount /vobs/test');
|
by: jane007 |
last post by:
Hello everybody:
I am having a problem.
On Unix platform, there is a script that need user to input data from console, then when I call Unix perl script from
Windows, these is an issue occurs, when I input data and enter "enter" so fast, the Windows console is freezed, I don't know
why, does anybody know?Thank you very much.
My code like follows:
|
by: mdshafi01 |
last post by:
Hi ,
I am trying to send mail from unix perl.
I am using following code to send mail.
It is not triggering mail and also it is not giving any error.
please tell me any special settings are required or this program should be executed from special user with higher permission or something.
please tell me.
|
by: dxz |
last post by:
I have a perl script to run on both UNIX and Windows. How should I write the Shabang line:
On UNIX, it is
#!/usr/bin/perl
On Windows, it is
#!C:\perl\bin\perl.exe
Which one should I use?
Should I combine them?
If yes, how?
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| | |