Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

meaning of 'operator' (was Re: question on max | min op)
TSa wrote:
> Mark J. Reed wrote: 
>
> I'm not sure what the defined difference between function and operator
> is in Perl 6 but I make a very clear distinction. An operator is acting
> an *one* type, that is &op:(::T,T-->T) while a function is a mapping of
> different types &f:(::S,::T-->::R). IOW, Operator does Function but not
> the converse. So overloading an operator with inhomogenous types should
> not change the abstract properties of the operator but be a convenient
> form to upgrade the operants.

I consider an operator to be any pure routine whose invocation does not
carry any side-effects besides possibly updating the values of some of its
arguments; any values that its invocation results in or that any of its
arguments are set to is dependent only on the values of its arguments.

There is no restriction on what the types of its parameters or results are;
they can be of the same types or different types; eg a pure function to
cast a number as a string is an operator.

Whether or not something is an operator has nothing to do with syntax, just
semantics.  Either a function (which results in a value) or a procedure
(which does not) can be an operator.  Infix|prefix|postfix|.meth|func() etc
does not matter, that is all just syntax.  As a trivial case, a procedure
with zero parameters either isn't an operator or is a no-op.

Any routine which looks at or manipulates the environment is not an operator
.

Most language built-ins would qualify as operators, including all pure
functions and ordinary assignment operators.

Built-ins that would not be operators include: print, curr_time, <$*STDIN> e
tc.

-- Darren Duncan

Report this thread to moderator Post Follow-up to this message
Old Post
Darren Duncan
04-02-08 09:14 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL 6 Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:28 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.