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

[svn:perl6-synopsis] r14531 - doc/trunk/design/syn
Author: larry
Date: Mon Mar 31 11:15:33 2008
New Revision: 14531

Modified:
doc/trunk/design/syn/S03.pod

Log:
Some clarifications on Num and Int coercions.
Removed lame joke about truncating rats.


Modified: doc/trunk/design/syn/S03.pod
 ========================================
====================================
==
--- doc/trunk/design/syn/S03.pod	(original)
+++ doc/trunk/design/syn/S03.pod	Mon Mar 31 11:15:33 2008
@@ -12,9 +12,9 @@

Maintainer: Larry Wall <larry@wall.org>
Date: 8 Mar 2004
-  Last Modified: 17 Mar 2008
+  Last Modified: 31 Mar 2008
Number: 3
-  Version: 133
+  Version: 134

=head1 Overview

@@ -40,7 +40,7 @@
L  Concatenation     ~
X  Junctive and      &
X  Junctive or       | ^
-    L  Named unary       rand sleep abs
+    L  Named unary       sleep abs sin
N  Nonchaining infix but does <=> leg cmp .. ..^ ^.. ^..^
C  Chaining infix    != == < <= > >= eq ne lt le gt ge ~~ === eqv !eqv
L  Tight and         &&
@@ -221,7 +221,7 @@

=item *

-Function call
+Function call with parens:

a(1)

@@ -263,6 +263,14 @@
its left, so it binds tighter than comma on the left but looser than
comma on the right--see List prefix precedence below.

+=item *
+
+0-ary functions
+
+    self
+    undef
+    rand
+
=back

=head2 Method postfix precedence
@@ -568,10 +576,11 @@

+$x

-Unlike in PerlĀ_5, where C<+> is a no-op, this operator coerces
-to numeric context in PerlĀ_6.  (It coerces only the value, not the
-original variable.)  The narrowest appropriate type of C<Int>, C<Num>,
-or C<Complex> will be returned.  A string containing two integers
+Unlike in PerlĀ_5, where C<+> is a no-op, this operator coerces to
+numeric context in PerlĀ_6.  (It coerces only the value, not the
+original variable.)  For values that are not already considered
+numeric, the narrowest appropriate type of C<Int>, C<Num>, or
+C<Complex> will be returned; however, string containing two integers
separated by a C</> will be returned as a C<Rat>.  Exponential notation
and radix notations are recognized.

@@ -721,7 +730,6 @@
from a lazy exception model.)

Use of C<div> on two C<Int> values results in a ratio of the C<Rat> type.
-Integerizing a rat involves truncating its tail.

=item *

@@ -941,16 +949,48 @@

=head2 Named unary precedence

+Functions of one argument
+
+    int
+    sleep
+    abs
+    sin
+    ...         # see S29 Functions
+
+Note that, unlike in PerlĀ_5, you must use the C<.meth> forms to default
+to C<$_> in PerlĀ_6.
+
+There is no unary C<rand> function in Perl 6, though there is a C<.rand>
+method call and a 0-ary C<rand> term.
+
=over

=item *

-Functions of one argument
+C<< prefix:<int> >>

-    rand sleep abs etc.
+Coerces to type C<Int>.  Floor semantics are used for fractional
+values, including strings that appear to express fractional values.
+That is, C<int($x)> must have the same result as C<int(+$x)> in all
+cases.  All implicit conversions to integer use the same semantics.

-Note that, unlike in PerlĀ_5, you must use the C<.meth> forms to default
-to C<$_> in PerlĀ_6.
+(Note that, despite the fact that C<int> is a valid native type
+name, this function does not express conversion to that native type.
+Such subtype conversions are done automatically upon assignment to
+a subtyped container, and fail if the container cannot hold the value.)
+
+=item *
+
+C<< prefix:<sleep> >>
+
+Suspends the current thread of execution for the specified number of second
s,
+which may be fractional.
+
+=item *
+
+C<< prefix:<abs> >>
+
+Returns the absolute value of the specified argument.

=back


Report this thread to moderator Post Follow-up to this message
Old Post
larry@cvs.perl.org
04-01-08 12:43 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 10:27 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.