Re: vulgar?

2019-12-05 Thread Tobias Leich
"it's the level of vulgarity you'd expect from a guy called S***ov."
... and know it's getting personal... -.-

Erez Schatz  schrieb am Do., 5. Dez. 2019, 11:42:

> it's the level of vulgarity you'd expect from a guy called S***ov.
>
> But seriously, it's nothing you won't see on basic cable or the Linux
> Kernel mailing list.
>
> Erez
> On 12/5/19 12:38 PM, Tom Browder wrote:
>
> On Thu, Dec 5, 2019 at 03:57 Todd Chester via perl6-users <
> perl6-us...@perl.org> wrote
> ...
>
>> I really like this guys style of writing and examples
>> for Perl6.
>>
>> But he can be a bit vulgar at times, which I ignore.
>> Is he doing it on purpose?
>
>
> Todd, I took a quick glance at the link you gave and all I saw was
> reference to the Brain* language (whose author I believe should be ashamed
> of himself for that name--something like "Braincramp" would have been
> better).
>
> I have all Andrew's books and read many of his blogs and never noticed any
> trend of vulgarity (which, I too, am sensitive to).  I do see evidence of
> several Perl and Raku people whose speech can sometimes be quite crude and
> blasphemous, but I'm afraid that's the modern world: good manners and
> civility have all but disappeared in public places. I will say, though,
> that the #Raku IRC channel has much less coarse lingo and much more
> kindness than most other places I visit.
>
> I have had several email conversations with Andrew and he seems like a
> nice person to me. I sometimes think non-native English speakers pick up
> bad speech habits because of the absolutely sewer-mouthed "popular" folks
> on Twitter.
>
> Best regards,
>
> -Tom
>
>


Re: rakudo bug 128427 perl 5 does not build on Darwin platforms with clock_gettime

2016-11-15 Thread Tobias Leich
Hi, if you let raukdo automatically rebuild nqp/moar, then you still 
were on an old revision of moarvm.

This revision did not contain the latest patch.

Please rebuild now, as I've updated the git revisions, so latest nqp and 
moarvm get build.


Am 15.11.2016 um 18:14 schrieb Brandon Allbery:


On Tue, Nov 15, 2016 at 8:53 AM, Andy Bach > wrote:


Well, I just nuked and built moar-nom here OSX 10.11.6/Xcode 8


This is not a MoarVM problem; it's a bug in the Xcode 8 (and 8.1) 
Command Line Tools and documented (poorly) in the Xcode 8 release 
notes. You must download the Xcode 7 Command Line Tools for 10.11 
(https://developer.apple.com/download/ need Apple ID, do *not* need a 
developer account!) and install them over the Xcode 8 Command Line Tools.


(Short version: the Xcode 8 Command Line Tools, including libraries, 
are for 10.12 only. 10.11 does not have clock_gettime, because it was 
added in 10.12. So all compile time testing finds it via CLT libs, but 
runtime won't find it because that lib comes from the OS install 
instead of Xcode.)


--
brandon s allbery kf8nh sine nomine associates
allber...@gmail.com  
ballb...@sinenomine.net 

unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net




[perl #109586] .pick on a large range needs more entropy

2016-10-16 Thread Tobias Leich via RT
PR was merged and test got added:
https://github.com/MoarVM/MoarVM/pull/357
https://github.com/perl6/roast/commit/67c494ced2

Thanks to all involved!


Re: C static analysis on rakudo sources

2016-10-16 Thread Tobias Leich

Hi, I removed the obvious false-positives from the list.

I'll open tickets by categroy of the errors.


Thank you very much!


Am 15.10.2016 um 17:26 schrieb Dmitry Karasik:

Dear all,

I've had access to a of C/C++ static analysis tool PVS Studio,
and ran it against the latest rakudo sources [1]. The majority of notes seems
to be noise, but there were found some valid concerns (or at least looking
valid to me) f.ex.  this:

MoarVM/3rdparty/dynasm/dasm_x86.h:125
realloc() possible leak: when realloc() fails in allocating memory, original
pointer 'D->lglabels' is lost. Consider assigning realloc() to a temporary
pointer.

You probably might find it interesting to look at the log

[1] http://karasik.eu.org/misc/pvs/rakudo.log



Viva64-EM
full
8
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/callsite.c
error
V526
The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes.
false
3

if (num_flags && memcmp(cs1->arg_flags, cs2->arg_flags, num_flags))
return 0;

Viva64-EM
full
397
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/exceptions.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'snprintf' function. The SIGNED integer type argument is expected.
false
3
char*line_number = MVM_malloc(16);
snprintf(line_number, 16, "%d", annot ? annot->line_number : 1);

Viva64-EM
full
588
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/bytecode.c
error
V649
There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 581, 588.
false
2
/* Ensure no other thread has done this for us in the mean time. */
if (sf->body.fully_deserialized) {
MVM_reentrantmutex_unlock(tc, (MVMReentrantMutex *)cu->body.update_mutex);
581,588

Viva64-EM
full
1386
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
if (dlog) {
fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
fflush(dlog);

Viva64-EM
full
1386
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
if (dlog) {
fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
fflush(dlog);

Viva64-EM
full
1386
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the sixth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
if (dlog) {
fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
fflush(dlog);

Viva64-EM
full
1386
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the seventh actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
if (dlog) {
fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
fflush(dlog);

Viva64-EM
full
1423
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
if (dlog) {
fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
fflush(dlog);

Viva64-EM
full
1423
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
if (dlog) {
fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
fflush(dlog);

[perl #129353] [NATIVECALL][LTA] The error message of CStruct recommends to use Perl 6 native types

2016-10-09 Thread Tobias Leich via RT
Fixed with:
https://github.com/MoarVM/MoarVM/commit/688796b434
https://github.com/rakudo/rakudo/commit/a92f092ac5

The error message now reads:

$ perl6 -e 'class Foo is repr { has Buf $.a }'
===SORRY!=== Error while compiling -e
CStruct representation only handles attributes of type:
  (u)int8, (u)int16, (u)int32, (u)int64, (u)long, (u)longlong, num16, num32, 
(s)size_t, bool, Str
  and types with representation: CArray, CPointer, CStruct, CPPStruct and CUnion
at -e:1



[perl #127194] [NATIVECALL] tests fail on Raspberry Pi Debian/Wheezy

2016-10-09 Thread Tobias Leich via RT
This issue is fixed if you configure MoarVM with --has-libffi as of today.
(You need of course the libffi-dev package installed.)


[perl #123310] use of uninitialized value of type Any in string context in any !cursor_init

2016-09-25 Thread Tobias Leich via RT
This bug is no more, closing.


Re: [perl #129240] [NativeCall] nativesizeof routine returns the different result from sizeof function in C when it takes a CArray object as an argument.

2016-09-11 Thread Tobias Leich via RT
You get 8 there because an array is a pointerish thing...

Btw, this:
   my $not-null = CArray[int32].new
is not the same as this:
   int a[3];

So, we would need fixed sized native arrays here to tell the truth.

Am 10.09.2016 um 20:53 schrieb Brandon Allbery via RT:
> On Sat, Sep 10, 2016 at 10:11 AM, Itsuki Toyota <
> perl6-bugs-follo...@perl.org> wrote:
>
>> $ perl6 -MNativeCall -e 'my $null = Pointer; my $not-null =
>> CArray[int32].new; $not-null[0] = 1; $not-null[1] = 1; $not-null[2] = 1;
>> say nativesizeof($not-null)'
>> 8
>>
> That size looks doubly wrong to me. Its not going to happen for a 3-element
> array no matter how you slice it... so I suspect you're getting the size of
> one element, which is itself twice the size of what C thinks.
>




Re: [perl #129240] [NativeCall] nativesizeof routine returns the different result from sizeof function in C when it takes a CArray object as an argument.

2016-09-11 Thread Tobias Leich

You get 8 there because an array is a pointerish thing...

Btw, this:
  my $not-null = CArray[int32].new
is not the same as this:
  int a[3];

So, we would need fixed sized native arrays here to tell the truth.

Am 10.09.2016 um 20:53 schrieb Brandon Allbery via RT:

On Sat, Sep 10, 2016 at 10:11 AM, Itsuki Toyota <
perl6-bugs-follo...@perl.org> wrote:


$ perl6 -MNativeCall -e 'my $null = Pointer; my $not-null =
CArray[int32].new; $not-null[0] = 1; $not-null[1] = 1; $not-null[2] = 1;
say nativesizeof($not-null)'
8


That size looks doubly wrong to me. Its not going to happen for a 3-element
array no matter how you slice it... so I suspect you're getting the size of
one element, which is itself twice the size of what C thinks.





Re: How to properly represent c++ class hiearchy in nativecall?

2016-07-24 Thread Tobias Leich
Hi, the $.vtable Pointer is just there to allocate more space for the 
CPPStruct, and to properly align the struct attributes.


C++ itself cares about the vtable, not NativeCall.


What would help to fix any issues would be to prove a sample code in the 
style of the rakudo/t/04-nativecall/* tests.

(Without depending on qt of course)

Cheers, Tobias

Am 24.07.2016 um 09:03 schrieb Vladimir Marek:

Hi,

I'm playing with QT library in perl6. I got it somehow working, but now I
wonder whether I'm doing it right.

QT objects are C++ classes. Roughly there is base class QObject. From that
object QWidget isderived.

class QObject;
class QWidget : public QObject;
class QAbstractButton : public QWidget;
class QPushButton : public QAbstractButton;

you get the picture.


I have represented these in p6 like:

class QObject is repr {
 has Pointer $.vtable;
 ...
}

class QPushButton is repr is QObject {
 has Pointer $.vtable;
 ...
}

I have skipped for now QWidget and QAbstractButton for now. It works, but:


- isn't it a problem that both classes have the $.vtable variable? QPushButton
overriding QObject one? I guess that is ok though, there's always just a
single pointer.




- I have tried to mimick GTK::Simple tap providers, but failed.
class QPushButton is repr is QObject {
 has Pointer $.vtable;
 has $!clicked_supply;
}
===SORRY!=== Error while compiling /home/neuron/qt/qt.pl
CPPStruct representation only handles int, num, CArray, CPointer, CStruct, 
CPPStruct and CUnion




- I have tried to view QPushButton as a role to QObject

role QPushButton is repr is QObject {
 # line 63:
 my sub qt_QPushButton_show(QPushButton) is native('p6', v1) is 
mangled(False) { * };

===SORRY!=== Error while compiling /home/neuron/qt/qt.pl
Too many positionals passed; expected 2 arguments but got 3
at /home/neuron/qt/qt.pl:63

The same for

role QPushButton is QObject {



- I have tried

class QPushButton does QObject {
===SORRY!=== Error while compiling /home/neuron/qt/qt.pl
QObject is not composable, so QPushButton cannot compose it



I have not tried making QObject a unit, is it the way to go? I'm trying to chew
on the line from GTK::Simple. I'm not sure yet what it is and how relevant it
is.

unit class GTK::Simple::Button does GTK::Simple::Widget;


Thank you
__
 Vlad





[perl #128156] dependency errors

2016-06-12 Thread Tobias Leich via RT
These patches fix and test the remaining issue:
  https://github.com/rakudo/rakudo/commit/d0a00164e9
  https://github.com/perl6/roast/commit/716b94f7ff



[perl #127750] Intermittent failure on t/04-nativecall/13-union.t

2016-03-20 Thread Tobias Leich via RT
Hi, can I get verbose output please?


[perl #127408] LTA error message “cannot find method CALL-ME” ( *(42) )

2016-03-14 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/42fb81d3b7

Tagging testneeded


[perl #127482] Compilation check says Syntax OK but program gets error

2016-03-13 Thread Tobias Leich via RT
As mentioned it is syntactically legal, therefore the syntax chek reports OK.

It fails at runtime though, which is to be expected.

A compiler time error always prints this as the first line:
===SORRY!===


[perl #127482] Compilation check says Syntax OK but program gets error

2016-03-13 Thread Tobias Leich via RT
As mentioned it is syntactically legal, therefore the syntax chek reports OK.

It fails at runtime though, which is to be expected.

A compiler time error always prints this as the first line:
===SORRY!===


[perl #127671] 「dir」 dies if weird unicode sequences are encountered (dir;)

2016-03-13 Thread Tobias Leich via RT
Patch: https://github.com/MoarVM/MoarVM/commit/79dce1101b

I hesitate to put a test for this in...
Closing as resolved anyway.


[perl #126797] [BUG] rakudo / mingw / gmake test - all nativecall tests fail because of bad $*VM.config

2016-03-11 Thread Tobias Leich via RT
Closing as resolved.


[perl #125140] [FEATURE-REQUEST] NativeCall: Provide a mechanism to invoke function pointers

2016-03-11 Thread Tobias Leich via RT
Patches and test:
  https://github.com/MoarVM/MoarVM/commit/ada3752a81
  https://github.com/rakudo/rakudo/commit/a8f407cccd

Resolving ticket as fixed.


[perl #126797] [BUG] rakudo / mingw / gmake test - all nativecall tests fail because of bad $*VM.config

2016-03-11 Thread Tobias Leich via RT
Hi, can you please check if it is still broken?

The patch in https://github.com/rakudo/rakudo/commit/505dc4fa should fix it.


[perl #127598] white space affects which multiple dispatch subroutine is getting called.

2016-02-23 Thread Tobias Leich via RT
Hi, please consider using this slang which will most likely give you what you 
need:

  https://github.com/FROGGS/p6-Slang-Tuxic

But the short answer here is that the function call syntax wont change anymore.
Some examples that would break when we would change it:

if( # would not introduce a function call to a function called "if"
foo (1,2) # would stop passing a single list to a sub called foo.

The first shown example is important. Perl 6 does not want to reserve special 
keywords today and in future that ban functions of the same name. So there is 
syntax (whitespace) that disambiguates.
Image you have a function called mysub today in your enterprise application, 
and we make it a keyword in Perl 6.d. With your approach your code would break, 
with our approach a function call like mysub() would still work out.


Re: capture through regex variable

2016-02-22 Thread Tobias Leich

As a rule of thumb:

Every non-Letter character after the opening angle bracket makes it 
non-capturing.


Am 22.02.2016 um 11:37 schrieb Theo van den Heuvel:

Thanks Patrick,

it works great.

Theo

Patrick R. Michaud schreef op 2016-02-22 11:16:

Dynamic subregexes such as <$top> are non-capturing by default.  You
can easily capture the result by using something like 

Announce: Mac OS X Installer for release 2016.01

2016-02-12 Thread Tobias Leich

Thanks to Steve Mynott a Mac OS X installer is now available.
This installer has the ".dmg" file extension and is available from 
http://rakudo.org/downloads/star/.




Re: Installing both from rakudobrew and Rakudo Star

2016-02-05 Thread Tobias Leich
Btw, rakudobrew, rakudo via git and star are *not* installing to 
/usr/local/bin/.


rakudo via git and star install to ./install. But support the --prefix 
option to override this as shown.


Am 05.02.2016 um 08:27 schrieb Steve Mynott:

 From the recently updated http://www.perl6.org/downloads/

 % wget http://rakudo.org/downloads/star/rakudo-star-2016.01.tar.gz
 % tar xfz rakudo-star-2016.01.tar.gz
 % cd rakudo-star-2016.01
 # perl Configure.pl --gen-moar --prefix /opt/rakudo-star-2016.01
 # make install

On 5 February 2016 at 00:57, James E Keenan  wrote:

Follow-up questions to those I posed on perl6-users today.

So I have successfully used rakudobrew to build moar and panda.  That perl6
executable is located here:
$ which perl6
/home/jkeenan/.rakudobrew/bin/perl6

Now, suppose I *also* wish to install Rakudo Star.  I've downloaded the
rakudo-star-2016.01 tarball and have read the instructions in README for
installation.  From past experience, I guess that if I say simply:

$ perl Configure.pl --backend=moar --gen-moar
$ make
$ make install

... that this will install in /usr/local/bin/.  Is that recommended
(assuming that my main emphasis is on learning Perl6 in the context of a
beginners study group)?

Is there a PREFIX setting, should I wish to install it under my home
directory?

Thanks to all who worked on getting Rakudo Star yesterday and who
contributed to the earlier thread.

Jim Keenan







Announce: Windows MSI Installers for release 2016.01

2016-02-04 Thread Tobias Leich

The Windows MSI installers are now available, coming again in two versions.
One installer targets x86 (32bit) platforms, and the other installer 
targets x86_64 (64bit)
platforms (probably Windows 7 or better). Only the version for x86_64 
comes with JIT enabled.

The two MSIs are available from http://rakudo.org/downloads/star/.



Announce: Rakudo Star Release 2016.01

2016-02-03 Thread Tobias Leich

# Announce: Rakudo Star Release 2016.01

## A useful and usable production distribution of Perl 6

On behalf of the Rakudo and Perl 6 development teams, I'm happy to announce
the January 2016 release of "Rakudo Star", a useful and usable production
distribution of Perl 6. The tarball for the January 2016 release is 
available

from http://rakudo.org/downloads/star/.

This is the first post-Christmas (production) release of Rakudo Star and
implements Perl v6.c. It comes with support for the MoarVM backend (all 
module

tests pass on supported platforms).

Please note that this release of Rakudo Star is not fully functional 
with the

JVM backend from the Rakudo compiler. Please use the MoarVM backend only.

In the Perl 6 world, we make a distinction between the language ("Perl 
6") and

specific implementations of the language such as "Rakudo Perl". This Star
release includes release 2016.01.1 
 
of the Rakudo Perl 6 compiler , version
2016.01 of MoarVM , plus various modules, 
documentation, and other resources

collected from the Perl 6 community.

[release 2016.01]: 
https://raw.githubusercontent.com/rakudo/rakudo/2016.01.1/docs/announce/2016.01.md

[Rakudo Perl 6 compiler]: http://github.com/rakudo/rakudo
[MoarVM]: http://moarvm.org/

Some of the new compiler features since the last Rakudo Star release 
include:


+ Chained .grep calls on Supply fixed (RT #127297)
+ Fixed interaction with perl6-debug and precompilation that resulted in an
  endless loop
+ re-enabled warning when smart-matching against a True or False literal
+ Fixed internal error when reporting certain type errors (RT #127207)
+ Fixed rare "duplicate definition of symbol" errors (RT #127107)
+ Fixed interpolating of pairs with non-key strings into signatures
+ Fixed error when smart-matching Seq against a Set (RT #127166)
+ Improved error message when smart-matching against an S///-expression
+ Fixed bad interaction between EXPORTHOW and multiple declarations (RT 
#126566)

+ Fixed various issues regarding precompilation
+ Improved accuracy of Complex.sqrt
+ hyper now preserves order of results, as designed
+ Range.sum on an empty, numeric Range is now 0
+ Fixed Promise.allof() with an empty list of promises (RT #127101)
+ Improved message on premature virtual method call (RT #127097)
+ Better error message for module load failures of types that are part of
  the setting
+ Support for Readline in addition to Linenoise
+ Initial shaped array support
+ \r\n (Carriage Return/LineFeed) is now a single (synthetic) grapheme
+ Unicode support adheres to Unicode Annex #29
+ Unicode quotes are now also allowed in regular expressions
+ Improved newline support with "use newline" and updates to IO::Handle
+ Added List.head, List.tail, List.repeated methods
+ Str.encode now allows :replacement parameter for unencodable sequences
+ Str.split now accepts multiple strings to split on
+ New Range.int-bounds returns first/last value for integer ranges
+ Auto-generated meta-ops vivified by referring to them, instead of 
executing

+ Illegal assignment of different Numeric values now caught at compile time
+  implemented, which returns the routine that nextsame would 
invoke

+ Many speedups

Notable changes in modules shipped with Rakudo Star:

* Bailador: The PSGI module by default now sets p6sgi instead of psgi
* DBIish: Many fixes
* Digest::MD5: Updated to conform to new newline handling
* doc: p6doc -l added. p6doc now works for most non-core docs with pod
* LWP::Simple: Replace "as Int" with proper coercion type to fix build
* Linenoise: Many fixes
* MIME::Base64: Adjust to pack being made experimental
* panda: Large number of precomp and other bug fixes.  Now depends on 6.c
* Template::Mojo: use MONKEY-SEE-NO-EVAL
* Shell::Command: removed "as"

There are some key features of Perl 6 that Rakudo Star does not yet
handle appropriately, although they will appear in upcoming releases.
Some of the not-quite-there features include:

  * advanced macros
  * non-blocking I/O (in progress)
  * some bits of Synopsis 9 and 11

There is an online resource at http://perl6.org/compilers/features
that lists the known implemented and missing features of Rakudo's
backends and other Perl 6 implementations.

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are many
that we've missed. Bug reports about missing and broken features are
welcomed at rakudo...@perl.org .

See http://perl6.org/ for links to much more information about
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.
Perl 6 tutorials are available under the "docs" directory in
the release tarball.

The development team thanks all of the contributors and sponsors for
making Rakudo 

[perl #127308] Configure.pl with moar fails to find C compiler on older Darwin

2016-01-21 Thread Tobias Leich via RT
Does that mean that we *always always always* have a gcc binary?


[perl #127308] Configure.pl with moar fails to find C compiler on older Darwin

2016-01-21 Thread Tobias Leich via RT
Can't we do something like this[^1] on darwin also?

[^1] https://github.com/MoarVM/MoarVM/blob/master/build/setup.pm#L445

Like, checking for the existance of clang, and falling back to gcc?


[perl #127308] Configure.pl with moar fails to find C compiler on older Darwin

2016-01-20 Thread Tobias Leich via RT
But the shown exit of "0" would be correct, no?

I guess we want to show more information when we cannot compile the test 
scripts using the compiler we guessed


Re: Can I use my Perl5 .pm modules in Perl6?

2016-01-13 Thread Tobias Leich


Am 14.01.2016 um 01:31 schrieb ToddAndMargo:

On 01/13/2016 12:51 PM, David H. Adler wrote:

On Wed, Jan 13, 2016 at 12:50:19PM -0800, ToddAndMargo wrote:

Hi All,

I have written myself several Perl 5 modules (.pm).
Is there a way to call them from Perl6?  Or should I
must I rewrite them?


https://doc.perl6.org/language/faq#Can_I_use_Perl_5_modules_from_Perl_6%3F 



dha



Hi David,

Not to be dense, but will inline::Perl5 also work with
all those CPAN modules?

Also, does inline::Perl5 get installed natively when I
install Perl6, or do I need to install it afterwards?

Many thanks,
-T


Hi, you need to install Inline::Perl5 via panda.

$ panda install Inline::Perl5


Re: Mooch a regex

2016-01-12 Thread Tobias Leich
First of all, your fist line contains a bug, unless the topic variable 
($_) is set to something meaningful.

Because the regex after the 'and' matches against said topic. See:

~$ perl -E '$_ = "bar"; say ("foo" =~ /f+/ and /o/)' # "", so false
~$ perl -E '$_ = "bar"; say ("foo" =~ /f+/ and /a/)' # "1", so true

I guess you wanted to match $ClickLine against both regexes.
In Perl 6 I would it as:

# Continue if any of the two match, that pipe char describes an alternation.
if $ClickLine ~~ / aes256 | $BaseTag / {
push @WebClickHere, $ClickLine;

# Capture all non-dash characters in $.
if $Line ~~ / 'select id="' $=[ <-[-]>* ] / {
push @WebVersions, $
}
}

If $BaseTag contains a regex rule, say "fo+b.r", then you'd enclose it 
in angle brackets:

if $ClickLine ~~ / aes256 | <$BaseTag> / { # ...
This is alled a "regex assertion".


Am 12.01.2016 um 20:59 schrieb ToddAndMargo:

On 01/11/2016 11:24 PM, Tobias Leich wrote:

hi, what's in ${BaseTag}? Is it a regex rule or just a plain string?
(Because that matters in Perl 6)


It is a string and can vary.

Would you show me both ways to keep me out of trouble?



Am 12.01.2016 um 01:55 schrieb ToddAndMargo:

Hi All,

Would yo all terribly mind if I ask how to do this Perl 5 regex
in Perl 6?  (I learn best by example.)



if ( $ClickLine =~ /aes256/ and /${BaseTag}/ ) {
  push ( @WebClickHere, $ClickLine );

   if ( $Line =~ m{select id=\"(.*?)[-]} ) {
  my $VerLine = $1;
  push ( @WebVersions,  $VerLine );
   }
}


Many thanks,
-T











Re: Mooch a regex

2016-01-11 Thread Tobias Leich
hi, what's in ${BaseTag}? Is it a regex rule or just a plain string? 
(Because that matters in Perl 6)


Am 12.01.2016 um 01:55 schrieb ToddAndMargo:

Hi All,

Would yo all terribly mind if I ask how to do this Perl 5 regex
in Perl 6?  (I learn best by example.)



if ( $ClickLine =~ /aes256/ and /${BaseTag}/ ) {
  push ( @WebClickHere, $ClickLine );

   if ( $Line =~ m{select id=\"(.*?)[-]} ) {
  my $VerLine = $1;
  push ( @WebVersions,  $VerLine );
   }
}


Many thanks,
-T





Re: Rakudo star 2015.12?

2016-01-06 Thread Tobias Leich

I am working on it, and made some progress yesterday.

I hope to ship it soon.

Am 06.01.2016 um 01:57 schrieb Parrot Raiser:

There doesn't seem to be a tarball for rakudo star 2015.12. Is that
going to be skipped?




Re: Use of ':' in identifiers

2016-01-06 Thread Tobias Leich

Hi,

$foo:bar and Foo:bar are variable/package names with an colonpair 
appended. The entire thing is then called a longname, at least internally.


Test:ver(v1) makes it clearer what it does. You $abc:def example boils 
down to $abd:def(True) btw.


Am 06.01.2016 um 12:24 schrieb mt1957:

L.s.

I'am a bit confused about the use of ':' in an identifier. I've read a 
bit about the ':' twigil but that seems to be used at the front of the 
id giving it a special use. Under 'identifiers' on the syntax page I 
couldn't find any about it. So I am referring to things like $abc:def 
and the like. Is there information in the synopsis documents?


Thanks in advance
Marcel Timmerman




Re: [perl #127188] [IMPROVEMENT SUGGESTION] :lang on eval to attempt to use an Inline::FOO module

2016-01-06 Thread Tobias Leich
I still think that language modules like Inline::* or v5 need to 
register itself. Which means, you'd use such a module before doing the 
EVAL so the EVAL knows what module handles the requested language.


Am 06.01.2016 um 14:40 schrieb Zoffix Znet (via RT):

# New Ticket Created by  Zoffix Znet
# Please include the string:  [perl #127188]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=127188 >


Seeing that value of 'Perl5' for the :lang argument to EVAL attempts to load Inline::Perl5, 
I'm curious whether we could possibly make it attempt to work for ANY language by loading 
the appropriate Inline:: module. In other words, :lang would attempt to load 
Inline::Lua and :lang would attempt to load Inline::Ruby, both of which exist 
in our ecosystem.

$ perl6 -e 'EVAL "test", :lang;'
Could not find Inline::Perl5 in:
 /home/zoffix/.perl6/2015.12-101-g75c6b9e
 /home/zoffix/.rakudobrew/moar-nom/install/share/perl6/site
 /home/zoffix/.rakudobrew/moar-nom/install/share/perl6/vendor
 /home/zoffix/.rakudobrew/moar-nom/install/share/perl6
 CompUnit::Repository::AbsolutePath<-1229522756>
 CompUnit::Repository::NQP<-1229524784>
 CompUnit::Repository::Perl5<-1229526668>
   in block  at -e line 1

Could not find Inline::Perl5 in:
 /home/zoffix/.perl6/2015.12-101-g75c6b9e
 /home/zoffix/.rakudobrew/moar-nom/install/share/perl6/site
 /home/zoffix/.rakudobrew/moar-nom/install/share/perl6/vendor
 /home/zoffix/.rakudobrew/moar-nom/install/share/perl6
 CompUnit::Repository::AbsolutePath<-1229522756>
 CompUnit::Repository::NQP<-1229524784>
 CompUnit::Repository::Perl5<-1229526668>
   in block  at -e line 1

Actually thrown at:
   in block  at -e line 1

$ perl6 -e 'EVAL "test", :lang;'
No compiler available for language 'Lua'
   in any  at 
/home/zoffix/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm
 line 1
   in block  at -e line 1

$ perl6 -e 'EVAL "test", :lang;'
No compiler available for language 'Ruby'
   in any  at 
/home/zoffix/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm
 line 1
   in block  at -e line 1

$




Re: [perl #127165] [FEATURE] make :%hash a pair constructor

2016-01-05 Thread Tobias Leich

Yes, that's how you get a Match variable.


[perl #127173] [BUG] Cannot build on Alpine Linux

2016-01-05 Thread Tobias Leich via RT
libuv does not like to build here, which is a dependency of MoarVM.
Though, that does not mean that we cannot do something about that.


Re: [perl #127144] Native uint doesn't overflow on ++

2016-01-04 Thread Tobias Leich

That highlights the bug:

m: my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;
rakudo-moar 0f26ae: OUTPUT«255 -> 0␤»

m: my uint8 $x = 255; print $x, " -> "; $x++; say $x;
rakudo-moar 0f26ae: OUTPUT«255 -> 256␤»

Am 04.01.2016 um 11:48 schrieb Elizabeth Mattijsen:

On 04 Jan 2016, at 00:25, Juerd Waalboer (via RT) 
 wrote:

# New Ticket Created by  Juerd Waalboer
# Please include the string:  [perl #127144]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=127144 >


Bug:


my uint8 $x = 255; print $x, " -> "; $x = $x + 1; say $x;

255 -> 0

What is the bug here???  Looks to me it’s entirely doing what is expected?



Liz




Re: Erratic timings

2016-01-04 Thread Tobias Leich

Would be nice if someone could reproduce also.

Am 04.01.2016 um 14:38 schrieb Parrot Raiser:

Could the jumps to >1 seconds be explained by automatic pre-compilation taking 
place after
you re-compiled rakudo ?

Why would that happen occasionally, after a number of executions of
the same code? (If it was consistently the first run that was the long
one, I'd be looking at that, but it's not.)


Is this running on a real slow VM?  Or an older version of rakudo?

Real machine , 2.1Ghz  AMD Turion(tm) X2 Dual-Core Mobile RM-72

This is perl6 version 2015.11 built on MoarVM version 2015.11

It's far from a show-stopper, (p6 is now dramatically faster to load
than it used to be), but I thought it worth mentioning.




Re: release?

2015-12-29 Thread Tobias Leich
Hi, the first official Perl 6 (the language) release is not called 
6.0.0, it is called 6.c.

And this is what has been shipped with the Rakudo compiler release 2015.12.

Cheers, Tobias

Am 27.12.2015 um 20:33 schrieb webmind:

Hiya,

I'm a bit confused, there is a major release for Perl 6, but I know
wonder if this is the 6.0.0 release or when this will be?

Thanks

web





[perl #126959] unhelpful error - Cannot find method 'has_compile_time_value'

2015-12-22 Thread Tobias Leich via RT
Patches:
  https://github.com/rakudo/rakudo/commit/2e4238fbe4
  https://github.com/rakudo/rakudo/commit/0d5372fe43

Tests:
  https://github.com/perl6/roast/commit/94ee230558

Closing ticket as resolved.


[perl #126100] Wrong return value from "require"

2015-11-21 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/95558bb58e
Tests: https://github.com/perl6/roast/commit/ff452eb56a

Closing as resolved.


[perl #126675] [BUG][MOAR/NativeCall] Evaluating the size of a structure is wrongly done

2015-11-18 Thread Tobias Leich via RT
I can confirm that the alignment is wrong.

To prove, I created this repo: https://github.com/FROGGS/p6-Gumbo
Running `perl6 t` gives:
~/dev/gumbo$ perl6 t/00-structure-sizes.t
1..19
ok 1 - sizeof(size_t)
ok 2 - sizeof(GumboStringPiece)
ok 3 - sizeof(GumboSourcePosition)
ok 4 - sizeof(GumboVector)
ok 5 - sizeof(GumboTag)
ok 6 - sizeof(GumboNamespaceEnum)
ok 7 - sizeof(MyGumboTest)
not ok 8 - sizeof(GumboElement)

# Failed test 'sizeof(GumboElement)'
# at t/00-structure-sizes.t line 85
# expected: '96'
#  got: '104'

Which hints at the last two attributes of the GumboElement structure, as the 
ticket already pointed out.


[perl #126675] [BUG][MOAR/NativeCall] Evaluating the size of a structure is wrongly done

2015-11-18 Thread Tobias Leich via RT
The fix for this misalignment is: 
https://github.com/MoarVM/MoarVM/commit/7b382acd61
Test got added here: https://github.com/rakudo/rakudo/commit/deeec10a2e

Closing ticket as resolved.


[perl #126212] [BUG] SEGV on 16-bit-sized arg insertion

2015-11-14 Thread Tobias Leich via RT
The might be either this:

diff --git a/src/core/args.c b/src/core/args.c
index c4f2696..4772034 100644
--- a/src/core/args.c
+++ b/src/core/args.c
@@ -677,7 +677,7 @@ MVMObject * MVM_args_slurpy_named(MVMThreadContext *tc, 
MVMArgProcContext *ctx)
 
 static void flatten_args(MVMThreadContext *tc, MVMArgProcContext *ctx) {
 MVMArgInfo arg_info;
-MVMuint16 flag_pos = 0, arg_pos = 0, new_arg_pos = 0,
+MVMuint32 flag_pos = 0, arg_pos = 0, new_arg_pos = 0,
 new_arg_flags_size = ctx->arg_count > 0x7FFF ? ctx->arg_count : 
ctx->arg_count * 2,
 new_args_size = new_arg_flags_size, i, new_flag_pos = 0, new_num_pos = 
0;
 MVMCallsiteEntry *new_arg_flags;


Or this:

diff --git a/src/core/args.c b/src/core/args.c
index c4f2696..43a966a 100644
--- a/src/core/args.c
+++ b/src/core/args.c
@@ -702,7 +702,7 @@ static void flatten_args(MVMThreadContext *tc, 
MVMArgProcContext *ctx) {
 MVMint64count = REPR(list)->elems(tc, STABLE(list), list, 
OBJECT_BODY(list));
 MVMStorageSpec  lss   = 
REPR(list)->pos_funcs.get_elem_storage_spec(tc, STABLE(list));
 
-if ((MVMint64)new_arg_pos + count > 0x) {
+if ((MVMint64)new_arg_pos + count > 0xC000) {
 MVM_exception_throw_adhoc(tc, "Too many arguments in 
flattening array.");
 }
 



[perl #126189] [BUG] [LEAK] loop { 0, .1 ... 1000 }

2015-11-14 Thread Tobias Leich via RT
I did run this:

$ valgrind --leak-check=full --show-leak-kinds=all 
/home/froggs/dev/nqp/install/bin/moar  --execname="$0" 
--libpath="/home/froggs/dev/nqp/install/share/nqp/lib" 
--libpath="/home/froggs/dev/nqp/install/share/perl6/lib" 
--libpath="/home/froggs/dev/nqp/install/share/perl6/runtime" --full-cleanup 
/home/froggs/dev/nqp/install/share/perl6/runtime/perl6.moarvm -e 'my $x = 0; 
loop { 0, .1 ... 1000; exit if $x++ > 10; }'

And the two biggets memory consumoptions are:

==8073== 5,750,160 bytes in 239,590 blocks are still reachable in loss record 
2,318 of 2,319
==8073==at 0x4C2AB80: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8073==by 0x50396A6: MVM_malloc (alloc.h:2)
==8073==by 0x50396A6: MVM_bigint_div (bigintops.c:550)
==8073==by 0x4F95053: MVM_interp_run (interp.c:1717)
==8073==by 0x503F5CD: MVM_vm_run_file (moar.c:249)
==8073==by 0x401036: main (main.c:191)
==8073== 
==8073== 122,670,080 bytes in 239,590 blocks are still reachable in loss record 
2,319 of 2,319
==8073==at 0x4C2AB80: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8073==by 0x50497F9: mp_init_size (bn_mp_init_size.c:27)
==8073==by 0x5048345: mp_div (bn_mp_div.c:126)
==8073==by 0x50396DE: MVM_bigint_div (bigintops.c:574)
==8073==by 0x4F95053: MVM_interp_run (interp.c:1717)
==8073==by 0x503F5CD: MVM_vm_run_file (moar.c:249)
==8073==by 0x401036: main (main.c:191)

Note that there are still reachable. All non-reachable areas are just a bunch 
of kilobytes in size.


[perl #125573] [BUG] [Test] A failing exit phaser after passing all tests appears OK to prove

2015-10-27 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/6063886343
Test: https://github.com/perl6/roast/commit/2dfcd85181

Closing ticket.


[perl #120831] [BUG] LTA error message when declaring 'my Int a' in Rakudo

2015-10-27 Thread Tobias Leich via RT
Patch by bartolin++: 
https://github.com/rakudo/rakudo/commit/4bdc88046ad0289f2708e3195e59df9edc83c258
Another test: https://github.com/perl6/roast/commit/1145029340

Closing ticket.


[perl #126383] [NYI] Generic type can't participate in a coercive type

2015-10-26 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/6902d51eb7
Tests: https://github.com/perl6/roast/commit/7f43444370

Closing ticket.


[perl #125927] नि -- a grapheme cluster boundary algo problem (CCC = 0 can be a valid combiner?)

2015-10-26 Thread Tobias Leich via RT
Here are more examples (by novapatch++ via irc):

m: say «நி กำ षि "\r\n"»».chars
rakudo-moar cd7766: OUTPUT«(2 2 2 2)␤»


Re: perl6 book

2015-10-22 Thread Tobias Leich
I know that some ppl want to do that in future, but as far as I know
these projects are not in a state "planned" or even "started".

And since the semantics might change a little especially until
Christmas, I would not trust a book that is already in the works.

Am 22.10.2015 um 07:55 schrieb Wah Peng:
> Hello,
>
> is there a book "learning perl6" released or prepare to be released?
> Thanks.



Re: Coverity Static Analysis For NQP

2015-10-22 Thread Tobias Leich
3rdparty is used by the not quite used parrot backend, as well as the
path src/vm/parrot.

So I guess it does make sense to scan the MoarVM repository, but not NQP.

Am 21.10.2015 um 01:47 schrieb Jeffrey Ryan Thalhammer:
> 37 of them come from a path matching /3rdparty/
>
> The rest come from a path matching /src/
>
> You can tune all of this via scan.coverity.com 
>
> Hope that helps.
>
> -Jeff 



[perl #111726] [BUG] Smartmatching an empty all-conjunction with a regex produces an internal unboxing error in Rakudo

2015-10-20 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/5d83db3d01
Tests: https://github.com/perl6/roast/commit/51d1a4835f

Closing ticket.


[perl #103106] [BUG] Can't regex-match on a junction of strings in Rakudo

2015-10-20 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/5d83db3d01
Tests: https://github.com/perl6/roast/commit/51d1a4835f

Closing ticket.


[perl #68024] [TODO] Make :($op) work

2015-10-19 Thread Tobias Leich via RT
The design docs indicate that square brackets need to be used, which works with 
rakudo:

constant $foo="+"; say :[$foo](3, 4)
rakudo-moar 4b1df7: OUTPUT«7␤»

So, this is closable with test?


[perl #126172] [BUG] .push does something un(ex)-spec'd-ed

2015-10-19 Thread Tobias Leich via RT
The semantics of push got revised in the meantime, and a new method called 
"append" got added:

m: my @a = 1,2,3; my @b; @b.push: @a,; dd @b
rakudo-moar fae01f: OUTPUT«Array @b = [[1, 2, 3],]␤»

m: my @a = 1,2,3; my @b; @b.push: @a; dd @b
rakudo-moar fae01f: OUTPUT«Array @b = [[1, 2, 3],]␤»

m: my @a = 1,2,3; my @b; @b.append: @a,; dd @b
rakudo-moar fae01f: OUTPUT«Array @b = [1, 2, 3]␤»

m: my @a = 1,2,3; my @b; @b.append: @a; dd @b
rakudo-moar fae01f: OUTPUT«Array @b = [1, 2, 3]␤»

As you can see even the comma is not needed anymore.
"push" will always push a single thing even if it is an array.
And "append" kinda flattens an input array or list, and will potentially append 
several items.

Tagging testneeded.


[perl #126172] [BUG] .push does something un(ex)-spec'd-ed

2015-10-19 Thread Tobias Leich via RT
Added test: https://github.com/perl6/roast/commit/f50149e607

Closing ticket.


[perl #126385] initial stray space not accepted in :(...)

2015-10-19 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/4b1df7b018
Tests: https://github.com/perl6/roast/commit/0478776107

Closing ticket.


Re: Coverity Static Analysis For NQP

2015-10-19 Thread Tobias Leich
"Coverity Scan Static Analysis - Find and fix defects in your Java,
C/C++, C# or JavaScript open source project for free"

How does that work for code written in NQP?

Cheers, Tobias

Am 17.10.2015 um 00:38 schrieb Jeffrey Ryan Thalhammer:
> Hello everyone-
>
> I'm a longtime Perl5 developer and the creator of Perl::Critic. More
> recently, I started working for Coverity, which makes commercial
> static analysis tools.
>
> Coverity offers a free analysis service through scan.coverity.com
> . This service is used by thousands of open
> source projects, including Perl5.
>
> I ran a local analysis of the NQP codebase and found 119 potential
> defects. If you enlist your project at scan.coverity.com
>  you can get all the details.
>
> Can't wait until Christmas!
>
> -Jeff



[perl #77564] * quantifier after block in regexp executes it infinite amount of times

2015-10-19 Thread Tobias Leich via RT
Patches:
https://github.com/perl6/nqp/commit/41ab646099
https://github.com/rakudo/rakudo/commit/de4b2b3a87

Tests:
https://github.com/perl6/roast/commit/95ee3272ab

Closing ticket.


[perl #123005] [BUG] $/ broken for replacement inside for loop

2015-10-18 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/32d7b08334
Tests: https://github.com/perl6/roast/commit/f665268fde

Closing ticket.


[perl #125598] [BUG] $/ does not bind correctly in the right-hand side of s/// inside a for loop in Rakudo

2015-10-18 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/32d7b08334
Tests: https://github.com/perl6/roast/commit/f665268fde

Closing ticket.


[perl #126349] [BUG] substitution of Array of Str fails to provide backreferences

2015-10-18 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/32d7b08334
Tests: https://github.com/perl6/roast/commit/f665268fde

Closing ticket.


[perl #118705] [BUG] s/// doesn't update $/ inside for loop

2015-10-18 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/32d7b08334
Tests: https://github.com/perl6/roast/commit/f665268fde

Closing ticket.


Re: Backwards compatibility and release 1.0

2015-10-15 Thread Tobias Leich


Am 15.10.2015 um 10:47 schrieb Smylers:
> Moritz Lenz writes:
>
>> On 10/13/2015 10:52 AM, Richard Hainsworth wrote:
>>
>>> Following on the :D not :D thread, something odd stuck out.
>>>
>>> On 10/13/2015 03:17 PM, Moritz Lenz wrote:
 We have 390+ modules, and hand-waving away all trouble of
 maintaining them seems a bit lofty.
>>> Surely, the idea of keeping the release number below 1.0 is to warn
>>> early adopter developers that code is subject to change and thus in
>>> need of maintenance?
>> ... a large percentage of the module updates are done by group of
>> maybe five to a dozen volunteers. ... 5 people updating 70% of 390
>> modules. Modules they are usually not all that familiar with, and
>> usually don't have direct access. So they need to go through the pull
>> request dance, waiting for reaction from the maintainer. In short, it
>> sucks.
> Thanks for the explanation, Moritz. That does make sense.
>
> I'm still a _little_ uneasy because that sounds a bit like the
> explanation of why Makefiles have to use tab characters:
>
>   I just did something simple with the pattern newline-tab. It worked,
>   it stayed. And then a few weeks later I had a user population of about
>   a dozen, most of them friends, and I didn't want to screw up my
>   embedded base. The rest, sadly, is history.
>   
> — Stuart Feldman http://stackoverflow.com/a/1765566/1366011
>
> Though the important difference is that invisible whitespace characters
> that some editors don't even let you type are particularly
> beginner-hostile, whereas allowing undef arguments where they don't make
> sense (and hence where callers don't generally try supplying undef) is
> something that many Perl 5 programs have been doing for years with no
> widespread harm.
>
> Cheers
>
> Smylers
Btw, In my opinion the current model about :D etc is very correct. I
don't see any need to change the
defaults as how type objects or their definedness is implementet.
Changing for example the params
to mean Int:D by default when one writes Int is something you have to
explain a lot. And in fact it is a lie.
There are some basic rules about Perl 6 like TIMTOWTDI and DRY, but
there is also a rule about "All is
fair if you predeclare". But if I don't predeclare that I mean Int:D by
writing Int, then the compiler is
not allowed to change the meaning of what I wrote.

That said, if there was a change that justifies breaking a lot of stuff,
I'm for it. But here it is certainly
not the case.

--
Tobias


Re: To :D or not to :D

2015-10-14 Thread Tobias Leich

> * Patrick R. Michaud (pmich...@pobox.com) [151013 01:05]:
>> On Tue, Oct 13, 2015 at 12:32:01AM +0200, Mark Overmeer wrote:
>>> Yes, that what I started realizing when I saw all the pain Perl6 goes to
>>> ignore the existence of a real "undef" in the language.  (I follow Perl6
>>> from a short distance since its start, read all original designs, but
>>> this penny did not drop before, sorry)
>> Actually, it's the other way around.  Perl 6 is not trying to ignore
>> the existence of an "undef", it's recognizing that there are in fact
>> many different kinds of undef.  It's the languages that think there's
>> only one "real undef" that are confused.  :)
> Yes, I like the typed undef... as real undef.  Let's call it "Car:undef"
> when it fits in a Car typed variable which is not used yet.  Easy to
> understand for Perl5 people.
Why do we need to add an adverb on a type to talk about the type? If you
want to pass a class around
for example, do you alsway want to but an ":undef" on it? Then somebody
would ask: "What do I get when
I dont put said :undef on it?" - And the answer might be "Well, you get
basically the same."
Also please keep in mind that Perl 6 does not have to be seen from a
Perl 5 perspective. There are more
valid views.
>>> my Car $a; my Car $b;   Now I have two different types.  
>> Not really, you have two variables, both of which have been
>> initialized to the same (undefined) Car object.  It's not
>> much different than
>>
>>my Int $a; my Int $b;  $a = $b = 1;
>>
>> where $a and $b end up being variables that contain the same
>> Int object.
> This is a different view on the syntax layer: implementor vs programmer.
> As programmer, knowing of optimizations of this kind adds to the
> confusion, not to the understanding.  As long as
>my Int $a; my Int $b;  $a = $b = 1; $b = 2; $a.say, $b.say
> produces 1\n2\n, I'm fine with any implementation.  I don't want to know
> how it is done internally.
No, rot really. You stated that you have two dirrenent types there, but
it really is the very same type.
It is just so that two variables containing it.
>> I think Self would be the (pardon the pun) prototypical example, and
>> it's also a common feature of JavaScript.  As to whether there is
>> precedence in other "successful" programming languages
> I use it in JavaScript. I reread a few tutorials about OO/prototype
> in Javascript yesterday.  They smoothly speak about adding methods to
> objects etc.  They speak about types and objects in a very natural way.
> They don't speak about undef objects to contain types, which are used
> as object factory.  I have not found the need for :U there.
I've also not used :U in Perl 6 yet. There might be scenarios where you
want to accept, say, class definitions
only but these cases are rare I'd say. More often you call a
construction on a type, or smartmatch a value
agains a type. And this really happens regularly in idomatic Perl 6 code.
>> Perl 6 still has classes and instances, but Perl 6 also adds the 
>> ability to represent undefined instances of a type (or, rephrased,
>> to have typed "undefs").  Perl 6 then binds the commonly-used 
>> identifier (e.g., C) to an undefined instance rather than the 
>> class object that defines the instances.  Once you accept that model,
>> it seems to work out very well in practice.
> Trying to reformulate this without spoilers of internal details:
>
>   Perl6 has classes, instances, and prototypes.  Commonly used
>   types, like Int, are prototypes based on classes.  Therefore,
>   they can easily absorb features via Roles and Mixins.
>
>   Note about the internals: we are not keeping a separate
> administration of type features, but keep that inside the
> instantiated objects.  As all prototype-based languages do.
>
> Acceptable?
>
>> If Research refers instead to the class definition, then the 
>> method namespaces for instances and classes begin to clash, and
>> we have to introduce all sorts of disambiguation for that.
> Yes, disambiguation either via a keyword (class method/instance method)
> or via the invocant (being a type :T or instance... multi methods to
> the rescue)
>
> For me, prototypes in JavaScript work well, because all graphical
> elements on the screen are slightly different in behavior.  I am a bit
> afraid to get into swamps when programs are large, where it is already
> hard to keep track on all the cleanly organized classes.
>
> So... my hessitation seems to be limited to the explanation and name
> of the flag :U, which tell me that a type is an undef.  Type defining
> features are loaded into a base object which does not carry a value: yes.
> Via specialization you get objects which carry a value.
>
> Maybe this comes back to the distiction between implicit and explicit
> undefinedness.



[perl #126350] [BUG] segmentation fault with precompile + add_method

2015-10-13 Thread Tobias Leich via RT
It seems to segfault in the op getlex when trying to locate 

Moving sub foo to within the BEGIN block helps and moving it outside of A gives:
Cannot invoke this object
  in method  at lib/A.pm6:5

Neither the rakudo optimizer nor spesh seem to be to blame.


[perl #126284] --> Int:D allowed but not checked correctly

2015-10-11 Thread Tobias Leich via RT
Seems to work now that we have DefiniteHOW:

m: sub a() returns Int:U { 42 }; say  a
rakudo-moar 8f4e90: OUTPUT«(Int:U)␤Type check failed for return value; expected 
Int:U but got Int␤  in sub a at /tmp/LRo5pcMZof:1␤  in block  at 
/tmp/LRo5pcMZof:1␤␤»

m: sub a() returns Int:D { Int }; say  a
rakudo-moar 8f4e90: OUTPUT«(Int:D)␤Type check failed for return value; expected 
Int:D but got Int␤  in sub a at /tmp/SnKt55D7zj:1␤  in block  at 
/tmp/SnKt55D7zj:1␤␤»

Tagging it testneeded.


[perl #126284] --> Int:D allowed but not checked correctly

2015-10-11 Thread Tobias Leich via RT
Marked existing tests as related to this ticket:
https://github.com/perl6/roast/commit/5bd83c5b01

Closing ticket.


[perl #126291] [BUG] :D on attrs and vars fails with a defined default value

2015-10-10 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/80a3d07235
Tests: https://github.com/perl6/roast/commit/071720b28d

Closing ticket.



[perl #123083] [BUG] `anon enum` should work the same way as `enum ::`, and `my %e = enum ::` should work too in Rakudo

2015-10-10 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/8f4e908869
Test: https://github.com/perl6/roast/commit/f47d1dab1b

Closing ticket.


[perl #67700] Method calls after blocks passed to list-operator methods are parsed incorrectly

2015-10-10 Thread Tobias Leich via RT
Design docs got aligned to rakudo so that method calls on blocks just do what 
one would expect.

Patch: https://github.com/perl6/specs/commit/d1d502fb71
Tests: https://github.com/perl6/roast/commit/95a28225ed

Closing ticket.


[perl #123083] [BUG] `anon enum` should work the same way as `enum ::`, and `my %e = enum ::` should work too in Rakudo

2015-10-10 Thread Tobias Leich via RT
Two more tests: https://github.com/perl6/roast/commit/51332a9ae1


[perl #126296] [BUG] Foo:D type on attribute should imply 'is required' and not need intialiser

2015-10-08 Thread Tobias Leich via RT
I don't think that we should mix two concepts here.

The type constraint of an attribute just tells us what types/subsets are 
allowed to be contained in the attribute.

That an attribute should be passed when instantiating an object (maybe passed 
but undef?) is another story. And this has not much to do with definedness of 
an attribute.


[perl #101448] [BUG] No error on assigning a type object to a :D-constrained container in Rakudo

2015-10-07 Thread Tobias Leich via RT
Added tests:
https://github.com/perl6/roast/commit/fca109de6c
https://github.com/perl6/roast/commit/6e66b7a18d

Closing ticket.


[perl #101448] [BUG] No error on assigning a type object to a :D-constrained container in Rakudo

2015-10-06 Thread Tobias Leich via RT
This fixes reporting the file and line number:
https://github.com/rakudo/rakudo/commit/164953b3de


[perl #125846] Missing file/line information when importing module

2015-10-06 Thread Tobias Leich via RT
This fixes it:
https://github.com/rakudo/rakudo/commit/164953b3de

Tagging testneeded.


[perl #125846] Missing file/line information when importing module

2015-10-06 Thread Tobias Leich via RT
Test: https://github.com/perl6/roast/commit/73fc8c3d37

Closing ticket.


[perl #101448] [BUG] No error on assigning a type object to a :D-constrained container in Rakudo

2015-10-05 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/8dd74406e6

Tagging testneeded.


[perl #101448] [BUG] No error on assigning a type object to a :D-constrained container in Rakudo

2015-10-05 Thread Tobias Leich via RT
jnthn: I think we want to do it at MOP level in the future, if nothing else for 
speed.
jnthn: I think we should force an initializer on :D'd things. .new is a bad 
default. Try this: `class C { has $.x = rand }; for ^5 { my C:D $foo; say 
$foo.x }`
jnthn: also we totally drop the thing on the floor in some situations, like `my 
$x = Int:D; say $x`
jnthn: That latter one is why I was more pondering a MOP-level solution: so 
they are first class.
FROGGS: do we want to keep my patch in until then?
jnthn: I'm content with keeping it in, but please log the above somewhere in RT
jnthn: Oh, one more problem
jnthn: m: my Int:omg $x
camelia: rakudo-moar 8dd744: OUTPUT«===SORRY!===␤Unsupported type smiley 'omg' 
used in type name␤»
jnthn: That just nqp::die's instead of $/.CURSOR.panic, so we get no source 
position :(



[perl #69204] [BUG] Cannot combine infix:<.=> and string methodrefs in Rakudo

2015-10-03 Thread Tobias Leich via RT
I come to the conclusion that making $foo.="bar"() work is more useful than 
complaining about a potential P5ism.

So, patch and tests are here:
https://github.com/rakudo/rakudo/commit/98d9b87aaa
https://github.com/perl6/roast/commit/5f82bde7e0

Closing ticket.


[perl #126128] s/$~Q/$~Quote

2015-10-01 Thread Tobias Leich via RT
Patch: https://github.com/rakudo/rakudo/commit/f52f0db3fb


[perl #126143] [NYI] Array aliasing on matching

2015-10-01 Thread Tobias Leich via RT
This is fixed so far.

Patches:
https://github.com/perl6/nqp/commit/ada83f20892d3d027a0ac5e537ab1b111db1968e
https://github.com/perl6/nqp/commit/8402ce098192cdfe57bd438781d9f1322f63273c

Fixed tests:
https://github.com/perl6/roast/commit/eec7994c1f


Re: How to push a hash on an array without flattening it to Pairs?

2015-09-26 Thread Tobias Leich
Itemization helps:

m: my %h = x => 6, y => 7; my @a = $%h; say @a[0]
rakudo-moar 0132b6: OUTPUT«x => 6, y => 7␤»

m: my %h = x => 6, y => 7; my @a; @a.push: $%h; say @a[0]
rakudo-moar 0132b6: OUTPUT«x => 6, y => 7␤»

Am 26.09.2015 um 07:58 schrieb Gabor Szabo:
> In the first two cases the hash was converted to Pairs before
> assigning to the array.
> Only the third case gave what I hoped for. How can I push a hash onto
> an array as a single entity?
>
>
> use v6;
>
> my %h = x => 6, y => 7;
> say %h.perl; #  {:x(6), :y(7)}
>
> my @a = %h;
> say @a.elems;   #
> say @a[0]; # x => 6
>
>
>
> my @c;
> @c.push(%h);
> say @c.elems; # 2
> say @c[0];   # x => 6
>
>
> my @b;
> @b[@b.elems] = %h;
> say @b.elems;  # 1
> say @b[0];# x => 6, y => 7
>
>



Re: Method 'send' not found for invocant of class 'IO::Socket::INET'

2015-09-26 Thread Tobias Leich
You need to upgrade HTTP::Easy, it already contains a fix.

Am 26.09.2015 um 12:26 schrieb Gabor Szabo:
> And just to clarify launching this simple script (and then accessing
> it via a browser) would show the same problem:
>
> use lib 'lib';
>
> use Bailador;
>
> get '/' => sub {
> "hello world"
> }
>
> baile;
>
>
> On Sat, Sep 26, 2015 at 1:16 PM, Gabor Szabo  > wrote:
>
> In the cloned repository of Bailador I ran
>
> perl6 examples/app.pl 
>
> It launched the web server printing
>
> Entering the development dance floor: http://0.0.0.0:3000
> [2015-09-26T10:04:46Z] Started HTTP server.
>
> but when I tried to access it with a browser it crashed with:
>
> [2015-09-26T10:04:49Z] GET / HTTP/1.1
> Method 'send' not found for invocant of class 'IO::Socket::INET'
>   in method run at
> /Users/gabor/rakudo-star-2015.09/install/share/perl6/lib/HTTP/Easy.pm6:193
>   in sub baile at /Users/gabor/work/Bailador/lib/Bailador.pm:153
>   in block  at examples/app.pl:38 
>
>
> Any idea what's this and how to fix it?
>
> Oh and I found the INET module here:
> /Users/gabor/rakudo-star-2015.09//rakudo/src/core/IO/Socket/INET.pm
> it does not even seem to be "installed".
>
>
> regards
> Gabor
>
>



Re: require on string stopped working in rakudo 2015.09

2015-09-26 Thread Tobias Leich
Hi, that your example was working was an accident.

It is either:
require "path/to/Foo.pm";
- or -
require ::("Foo");

Cheers, FROGGS

Am 26.09.2015 um 06:47 schrieb Gabor Szabo:
> Hi,
>
> I am really glad Rakudo finally came out.
> I've installed in and tried to run the tests of Perl6::Maven.
>
> They quickly failed as I have been using 'require' on string
> to check if all the module compile properly.
>
> The following code now fails:
>
> use v6;
> my $name = 'Bailador';
> require $name;
>
>
> even though
>
> require Bailador;
>
> works.
>
> In 2015.07 both worked.
>
>
> I've fixed my script by switching to EVAL "use $module";
> but I wonder if this is a regression or a planned deprecation?
>
> Gabor
>
>



Re: Does Perl 6 use $a and $b in sorting?

2015-09-26 Thread Tobias Leich
sort accepts something callable with an arity of 2.

Subroutines, blocks and pointies will do:

say sort { $^a cmp $^b }, 5, 3, 2, 6, 4
OUTPUT«(2 3 4 5 6)␤»

say sort { $^left cmp $^right }, 5, 3, 2, 6, 4
OUTPUT«(2 3 4 5 6)␤»

say sort -> $a, $b { $a cmp $b }, 5, 3, 2, 6, 4
OUTPUT«(2 3 4 5 6)␤»

sub foo($a, $b) { $a cmp $b }; say sort , 5, 3, 2, 6, 4
OUTPUT«(2 3 4 5 6)␤»

The { $^a cmp $^b } form also creates a anonymous sub that has two
parameters, $^a and $^b.
The funny thing about these params is that their position in the
implicit signature is obtained by the
alphabetical order of the parameter names.

So, there are no $a and $b special variables, it is just the common way
of naming them.

Am 26.09.2015 um 18:00 schrieb Parrot Raiser:
> Because of the the special significance of $a and $b in Perl 5's sort
> comparison, I always avoid using the names in examples, lest it set a
> booby-trap for later.
>
> I've noticed "a" and "b' being used in some P6 examples. Are they no
> longer significant, or are they just a poor choice of identifier?



Re: [perl #126037] Redirecting standard streams in Proc causes wrong exit code

2015-09-11 Thread Tobias Leich
Thing is that you do not redirect, you capture the streams.

So if you capture out, you need to read the output and close it. The
return value of close will then tell you the right exit code.


Re: isn't $PERL6LIB separator ':' on unix ?

2015-09-09 Thread Tobias Leich
Please try $*DISTRO.cur-sep.

Am 08.09.2015 um 18:19 schrieb Marc Chantreux:
> hello, 
>
> on Linux 3.19.0-16, using perl6 version 2015.07.2 built
> on MoarVM version 2015.07.  i tested
>
>
> $ PERL6LIB=lib\;../dnsmanager-v6/lib perl6 t/basic.t
>
> ===SORRY!===
> Could not find X::html in any of:
>   file#lib;../dnsmanager-v6/lib
>   ...
>
> then i tried 
>
> $ PERL6LIB=lib:../dnsmanager-v6/lib perl6 t/basic.t 
>
> ===SORRY!===
> Could not find X::html in any of:
>   file#lib:../dnsmanager-v6/lib
>   ...
>
> so it seems $PERL6LIB doesn't split on the separators i used to use.
> any idea? 
>



Announce: Windows MSI Installers for release 2015.06

2015-07-14 Thread Tobias Leich
The Windows MSI installers are now available, coming again in two versions.

One installer targets x86 (32bit) platforms, and the other installer targets
x86_64 (64bit) platforms (probably Windows 7 or better).

Only the version for x86_64 comes with JIT enabled.

The two MSIs are available from http://rakudo.org/downloads/star/.



Announce: Rakudo Star Release 2015.06

2015-07-01 Thread Tobias Leich
# A useful, usable, early adopter distribution of Perl 6

On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the June 2015 release of Rakudo Star, a useful and usable
distribution of Perl 6. The tarball for the June 2015 release is
available from http://rakudo.org/downloads/star/.

This Rakudo Star release comes with support for the MoarVM
backend (all module tests pass on supported platforms).

In the Perl 6 world, we make a distinction between the language
(Perl 6) and specific implementations of the language such as
Rakudo Perl. This Star release includes [release 2015.06] of the
[Rakudo Perl 6 compiler], version 2015.06 of [MoarVM], plus various
modules, documentation, and other resources collected from the
Perl 6 community.

Other Rakudo Perl 6 Comiler changes included in this release:
https://github.com/rakudo/rakudo/blob/nom/docs/announce/2015.04.md
https://github.com/rakudo/rakudo/blob/nom/docs/announce/2015.05.md
https://github.com/rakudo/rakudo/blob/nom/docs/announce/2015.06.md
[Rakudo Perl 6 compiler]: http://github.com/rakudo/rakudo
[MoarVM]: http://moarvm.org/

Some of the new compiler features added to this release include:

* 0 (0 as a string) is now True, no special-casing anymore
* an Int() coercion type in a multi now creates two candidates: Any and Int
* native arrays
* starts-with/substr-eq/ends-with for comparing strings inside other strings
* where constraints on variable and attribute declarations
* 'is rw' parameters implemented for native subs (they get passed as a
pointer)
* use Foo:from\Perl5\ and EVAL $code, :lang\perl5\ are now supported as
   long as Inline::Perl5 is installed. Allows passing most of S01 spec
tests.
* NFG, NFC, NFD, Uni
* unit declaration needed for blockless packages
* Various API changes for the Great List Refactor, such as...
  + 'for' loops not longer flatten; use 'for flat' for that
  + .map no longer flattens, map as a listop does. Use .flatmap to get the
 old behavior
  + Likewise other methods that used to flatten their invocant no longer do:
all, any, one, none, unique, squish, min, max, minmax, classify, and
categorize
  + Nil no longer iterates like the empty List. Use () or Empty instead.
* .pick($n)/roll($n) now always return lists, even when $n == 1
* The is cached trait no longer works on methods, throws a NYI instead
* Method .map should be used instead of .for
* The REPL is strict by default now, that leaves only '-e' lines to be lax
* Implement new @*INC handling (about 30% faster startup time)
  (bare startup time is now below 100 ms on some machines)
* Implemented CUnions which map to the union C type definition for
NativeCall
* Implemented HAS declarator for attributes to mark it embedded into the
  CStruct or CUnion
* Lexical pragma 'use trace' now outputs statements on STDERR

There are some key features of Perl 6 that Rakudo Star does not yet
handle appropriately, although they will appear in upcoming releases.
Some of the not-quite-there features include:

  * advanced macros
  * non-blocking I/O (in progress)
  * much of Synopsis 9 and 11

There is an online resource at http://perl6.org/compilers/features
that lists the known implemented and missing features of Rakudo's
backends and other Perl 6 implementations.

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are many
that we've missed. Bug reports about missing and broken features are
welcomed at rakudo...@perl.org.

See http://perl6.org/ for links to much more information about
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources. A
draft of a Perl 6 book is available as docs/UsingPerl6-draft.pdf in
the release tarball.

The development team thanks all of the contributors and sponsors for
making Rakudo Star possible. If you would like to contribute, see
http://rakudo.org/how-to-help, ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.



Re: versioning - how to request different 'ver' per 'auth'?

2015-06-11 Thread Tobias Leich
Hi, that is a very interesting use case, and IMO a very valid one.

Currently the semantics are, to also explain the correct syntax of the
pair that follows a 'use NAME':
:authBar and :ver1.2 etc are of type Pair. Wenn the compiler hits a
use statement, it smartmatches
the distribution's auth/name/ver against the value of the corresponding
Pair.

That means these Pairs are valid:

:authBar # match literally
:auth(/\w+/) # regex match
:auth($author) # okay if $author is known at compile time
:auth(*.chars == 6) # oaky, whatevercode
:auth({ $_.starts-with('Bla') }) # okay, closure
:auth(- $auth { $auth ~~ /Bla/ }) # okay, something callable with arity
== 1
:auth({ $^auth ~~ /Bla/ }) # okay, something callable with arity == 1
etc

That also means we cannot match different version patterns for different
:auth patterns, because we only
pass one value to the Pair's value to smartmatch against. What I can
imagine though is that if the matcher
is callable, and has an arity of 2, we pass the CompUnit as the first
and the $auth as the second argument.
That needs consensus in #perl6 though.

Cheers, Tobias

Am 11.06.2015 um 05:26 schrieb Darren Duncan:
 So I have a question about versioning, either/especially about
 compilation units, but also Perl 6 itself.

 For context I refer to http://design.perl6.org/S11.html#Versioning .

 With regard to use statements and specifying 'auth' or 'ver' to
 restrict between versions, it seems to me that the spec defines them
 interacting in a cross-product fashion.

 For example, given this possibly incorrect syntax:

 use Dog:authcpan:TPF cpan:JRANDOM:ver(4-6, 10-15);

 ... that would be satisfied by any of TPF versions 4-6,10-15 or
 JRANDOM versions 4-6,10-15.

 However, what I want is to restrict the 'ver' differently depending on
 the 'auth', treating them more as the hierarchy they are, assuming
 that different authorities may go off and use different versioning
 schemes.

 The question I have is how to 'or' the following into a single 'use
 Dog' that isn't any less restrictive:

 use Dog:authcpan:TPF:ver(v1.2.1..v1.2.3);
 use Dog:authcpan:JRANDOM:ver(v14.3..v16.2);

 That is, the cross-product answer is not restrictive enough.

 I don't know if this hypothetical use case has been discussed before,
 but if not, I hope that the Perl 6 specification has or can gain a
 clean way to say how its done.

 Thank you.

 -- Darren Duncan



Re: Problem found with PERL6LIB environment variable

2015-06-08 Thread Tobias Leich
Hi, you might use this:

say $*DISTRO.cur-sep
rakudo-moar 228168: OUTPUT«,␤»


Am 08.06.2015 um 21:17 schrieb Brandon Allbery:
 On Mon, Jun 8, 2015 at 3:09 PM, Fields, Christopher J
 cjfie...@illinois.edu mailto:cjfie...@illinois.edu wrote:

 I had the same problem recently, tied to the revised path names
 (e.g. the ‘file#’ prefix).  Any reason for the change?  Kinda
 caught me by surprise.


 It's so that there can be things that are not directories of files
 that can be sources of modules (think: database, or a custom object
 that can look up modules somewhere else and import them from there).

 IIRC the colon separator was replaced with a semicolon?

 -- 
 brandon s allbery kf8nh   sine nomine
 associates
 allber...@gmail.com mailto:allber...@gmail.com  
ballb...@sinenomine.net mailto:ballb...@sinenomine.net
 unix, openafs, kerberos, infrastructure, xmonad  
  http://sinenomine.net



Re: Possible bug in NativeCall CStruct

2015-06-02 Thread Tobias Leich
Hi, when you install latest MoarVM, you can do this:

$ perl6 -e 'use NativeCall; class Foo is reprCStruct { has str $.bar
is rw }; my $foo = Foo.new(bar = bar); say $foo; $foo.bar = baz;
say $foo'
Foo.new(bar = bar)
Foo.new(bar = baz)

Note the lowercase str type.
The normal Str type can be set by binding to the $!bar attribute from
within the class, but not from the outside via arguments to .new sadly.

Cheers, FROGGS

Am 02.06.2015 um 19:38 schrieb Douglas E. Miles:
 Hi all!

 I just started learning Perl 6 about 5 days ago, so I may not know
 what I'm talking about, but I may have found a bug. I posted to #perl6
 with my original code, and raydiak and timotimo were nice enough to
 golf it down for me:

 Str in CStruct blows up:
 $ perl6
  use NativeCall; class Foo is repr('CStruct') { has Str $.str }; my
 $foo = Foo.new(str = 'bar');
 Cannot modify an immutable Str
   in block unit at unknown file:1
   in any unit-outer at unknown file:1

 int32 in CStruct works fine:
 $ perl6
  use NativeCall; class Foo is repr('CStruct') { has int32 $.i }; my
 $foo = Foo.new(i = 42);
 Foo.new(i = 42)
  say $foo.i
 42

 Please let me know if I'm doing something wrong, or if this is a legit
 bug. Thanks!



Re: Perl 5's $0 vs. Perl 6's $*EXECUTABLE_NAME

2015-05-30 Thread Tobias Leich
Please also take a look at $*EXECUTABLE, $*PROGRAM and $*PROGRAM_NAME.

Am 30.05.2015 um 15:00 schrieb Tom Browder:
 I finally found the Perl 6 version of Perl 5's $0 listed in:

   tablets.perl6.org/appendix-b-grouped.html#special-variables

 as '$*EXECUTABLE_NAME', and I expected it to act the same as $0 in
 Perl 6, but I have two problems with it:

 1.  When used it yields 'perl6' regardless of the script's name (a bug?).

 $ cat t.pl
 #!/usr/bin/env perl6
 say $*EXECUTABLE_NAME;
 $ chmod +x t.pl
 $ ./t.pl
 perl6

 2.  It seems very ungainly to go from two characters to 17.  Couldn't
 it be shortened a bit, say,

   '$*0' or '$*EXE_NAME' or '$*PROG' or something else?

 Am I doing something wrong or do I have the wrong expectations?

 $  perl6 --version
 This is perl6 version 2015.03-48-g9746e88 built on MoarVM version 2015.03

 Best regards,

 -Tom



Announce: Rakudo Perl 6 compiler, Development Release #88 (Dresden)

2015-05-22 Thread Tobias Leich
On behalf of the Rakudo development team, I'm happy to announce the May
2015 release of Rakudo Perl 6 #88 Dresden. Rakudo is an implementation of
Perl 6 on the Moar Virtual Machine[^1] and the Java Virtual Machine. The
tarball for this release is available from
http://rakudo.org/downloads/rakudo/.

Please note: This announcement is not for the Rakudo Star
distribution[^2] --- it's announcing a new release of the compiler
only. For the latest Rakudo Star release, see
http://rakudo.org/downloads/star/.

The Rakudo Perl compiler follows a monthly release cycle, with each
release named after a Perl Mongers group. This month's release is named
after
Dresden, where this year's German Perl Workshop happened.

Some of the changes in this release are outlined below:

* NFG, NFC, NFD, Uni
* Implemented CLIENT:: (nearest CALLER:: from different package)
* Implemented is nodal for signalling behaviour under hypers
* Rudimentary tab completion available via the Linenoise module
* unit declaration needed for blockless packages
* Various API changes for the Great List Refactor, such as...
  + 'for' loops not longer flatten; use 'for flat' for that
  + .map no longer flattens, map as a listop does. Use .flatmap to get the
 old behavior
  + Likewise other methods that used to flatten their invocant no longer do:
all, any, one, none, unique, squish, min, max, minmax, classify, and
categorize
  + Nil no longer iterates like the empty List. Use () or Empty instead.
* .pick($n)/roll($n) now always return lists, even when $n == 1
* $?FILE is now always an absolute path
* The is cached trait no longer works on methods, throws a NYI instead
* Method .map should be used instead of .for
* Test.pm functions are now kebab-cased (e.g. throws_like - throws-like)
* Hashes use much less memory on Moar
* The REPL is strict by default now, that leaves only '-e' lines to be lax
* site/lib is now in the C library (.dll/.so/.dylib etc) search path
* generating backtraces is now lazy, improving the speed of e.g. warnings
* Implement new @*INC handling (about 30% faster startup time)
  (bare startup time is now below 100 ms on some machines)
* Implemented CUnions which map to the union C type definition for
NativeCall
* Implemented HAS declarator for attributes to mark it embedded into the
  CStruct or CUnion

These are only some of the changes in this release. For a more
detailed list, see docs/ChangeLog.

The development team thanks all of our contributors and sponsors for
making Rakudo Perl possible, as well as those people who worked on
Parrot, the Perl 6 test suite, MoarVM and the specification.

The following people contributed to this release:

Elizabeth Mattijsen, Jonathan Worthington, Tobias Leich, Sterling Hanenkamp,
Arne Skjærholt, Paul Cochrane, Larry Wall, Rob Hoelz, Carl Masak, raydiak,
Timo Paulssen, Christian Bartolomäus, Will Coke Coleda, Bart Wiegmans,
Moritz Lenz, Jonathan Stowe, skids, Pepe Schwarz, Brent Laabs, Steve Mynott,
Jeffrey Goff, Solomon Foster, Radek Slupik, Elise, tony-o, Stefan Seifert,
Jimmy Zhuo, Nicholas Clark, Brad Gilbert, Nick Logan, ven, lembark,
Justin DeVuyst, David Warring, Xinyuan Wang, David Farrell

If you would like to contribute, see http://rakudo.org/how-to-help,
ask on the perl6-compi...@perl.org mailto:perl6-compi...@perl.org
mailing list, or ask on IRC #perl6
on freenode.

The next release of Rakudo (#89), is scheduled for 18 June 2015.
A list of the other planned release dates and code names for future
releases is available in the docs/release_guide.pod file. A Rakudo
development release typically occurs a few days (often two) after the
third Tuesday of each month.

The development team appreciates feedback! If you're using Rakudo, do
get back to us. Questions, comments, suggestions for improvements, cool
discoveries, incredible hacks, or any other feedback -- get in touch with
us through (the above-mentioned) mailing list or IRC channel. Enjoy!

[^1]: See http://moarvm.org/

[^2]: What's the difference between the Rakudo compiler and the Rakudo
Star distribution?

The Rakudo compiler is a compiler for the Perl 6 language.
Not much more.

The Rakudo Star distribution is the Rakudo compiler plus a selection
of useful Perl 6 modules, a module installer, the most recent
incarnation of the Using Perl 6 book, and other software that can
be used with the Rakudo compiler to enhance its utility.  Rakudo Star
is meant for early adopters who wish to explore what's possible with
Rakudo Perl 6 and provide feedback on what works, what doesn't, and
what else they would like to see included in the distribution.



Re: Will Perl 6 save a compiled version of a source program like Python?

2015-05-18 Thread Tobias Leich
We precompile modules using a command line option like in: 'perl6
--target=mbc --output=foo.pm.moarvm'.
Though, since this is for modules, only this incantation will work:
'perl6 -I. -Mfoo -e1'

We are working on creating executables such as 'foo.exe' from a given
Perl 6 script, though I expect that this takes a few months before this
feature lands.
These executable would contain the Perl 6 interpreter, and the
precompiled script in one file.

Am 18.05.2015 um 14:28 schrieb Tom Browder:

 I found some discussion of such a capability on the Perl Mongers' site
 but haven't found anything official yet in the Synopses. 

 But I did find there an option that might do something related:
 --output-format (which is implementation defined).  However, I do not
 see that option in Rakudo Perl 6.

 Can anyone point me to more info or say yes or no to possible support
 of a save-compilation feature?

 Thanks.

 Cheers!

 -Tom




Re: [perl #125211] Error Function X::Panda needs parens to avoid gobbling block when running panda on JVM, but not on Moar

2015-05-18 Thread Tobias Leich
Btw, this error pops up when the X::Panda symbol disappears for some
weird reason. And then the parser thinks it is a sub instead of a type.

Am 18.05.2015 um 09:28 schrieb Moritz Lenz:


 On 05/18/2015 04:07 AM, Rob Hoelz (via RT) wrote:
 # New Ticket Created by  Rob Hoelz
 # Please include the string:  [perl #125211]
 # in the subject line of all future correspondence about this issue.
 # URL: https://rt.perl.org/Ticket/Display.html?id=125211 


 The full error message:

 ===SORRY!===
 Function X::Panda needs parens to avoid gobbling block
 at bin/panda:21
 -- Panda { %failed{$x}.push($_)  say $_ }⏏ };
 Missing block (apparently taken by 'X::Panda')
 at bin/panda:21
 -- anda { %failed{$x}.push($_)  say $_ } ⏏};

 Could you please supply a self-contained sample code that triggers
 this error?

 Thanks!





Re: generating grammars, capturing in regex interpolation, etc.

2015-04-17 Thread Tobias Leich

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

The comment in  INTERPOLATE is about subcaptures... but if you do not
capture the interpolated regex itself, you break that chain.

Am 17.04.2015 um 04:34 schrieb Nathan Gray:
 On Wed, Apr 15, 2015 at 09:45:39PM -0400, Nathan Gray wrote:
 I had given up on using regexes embedded within regexes, because
 I could not get capturing to work.

 I did a backtrace on one of the test cases that fails, which led
 me to

   src/core/Cursor.pm

 in

   method INTERPOLATE(\var, $i = 0, $s = 0, $a = 0)

 with this comment:

   # Call it if it is a routine. This will capture if requested.
   return (var)(self) if nqp::istype(var,Callable);

 This seems to indicate that captures in the embedded regexes
 should capture.

 When the capture does not happen, is this a bug?

 The test cases I came up with, that illustrate capturing from
 embedded regexes (some which work, some which do not), are
 included below.

 -kolibrie

 use v6;
 use Test;

 my $year = '2015';
 my $month = '04';
 my $day = '11';
 my $date_string = $year-$month-$day;

 my $year_regex = rx/$year=[\d**4]/;
 my $month_regex = rx/$month=[\d\d?]/;
 my $day_regex = rx/$day=[\d\d?]/;
 my $separator = rx/'-'/;

 # Single named capture.
 {
 ok($date_string ~~ $year_regex, 'date string matches year regex');
 is(~$/, $year, 'matched is year string');
 is(~$/year, $year, 'year is captured');
 }

 # Single named capture in slashes.
 {
 ok($date_string ~~ /$year_regex/, 'date string matches year regex
when in slashes');
 is(~$/, $year, 'matched is year string when in slashes');
 is(~$/year, $year, 'year is captured when in slashes');  # Fails
 }

 # Single named capture embedded in named capture.
 {
 ok($date_string ~~ /$pattern=$year_regex/, 'date string matches
year regex when embedded');
 is(~$/, $year, 'matched is year string when embedded');
 is(~$/pattern, $year, 'pattern is captured when embedded');
 is(~$/patternyear, $year, 'year is captured when embedded');
 }

 # Single named capture embedded in named capture with brackets.
 {
 ok($date_string ~~ /$pattern=[$year_regex]/, 'date string
matches year regex when embedded with brackets');
 is(~$/, $year, 'matched is year string when embedded with brackets');
 is(~$/pattern, $year, 'pattern is captured when embedded with
brackets');
 is(~$/patternyear, $year, 'year is captured when embedded with
brackets');  # Fails
 }

 # Multiple named captures.
 {
 ok($date_string ~~ /$year_regex $separator $month_regex $separator
$day_regex/, 'date string matches multiple regexes in slashes');
 is(~$/, $date_string, 'matched is date string in multi regex with
slashes');
 is(~$/year, $year, 'year is captured in multi regex with
slashes');  # Fails
 is(~$/month, $month, 'month is captured in multi regex with
slashes');  # Fails
 is(~$/day, $day, 'day is captured in multi regex with
slashes');  # Fails
 }

 # Multiple named captures embedded in named capture.
 {
 ok($date_string ~~ /$pattern=$year_regex $separator $month_regex
$separator $day_regex/, 'date string matches multiple regexes when
embedded');
 is(~$/, $date_string, 'matched is date string in multi regex when
embedded');
 is(~$/pattern, $year, 'pattern is captured in multi regex when
embedded');
 is(~$/patternyear, $year, 'year is captured in multi regex
when embedded');
 is(~$/month, $month, 'month is captured in multi regex when
embedded');  # Fails
 is(~$/day, $day, 'day is captured in multi regex when
embedded');  # Fails
 }

 # Multiple named captures embedded in named capture with brackets.
 {
 ok($date_string ~~ /$pattern=[$year_regex $separator
$month_regex $separator $day_regex]/, 'date string matches multiple
regexes when embedded with brackets');
 is(~$/, $date_string, 'matched is date string in multi regex when
embedded with brackets');
 is(~$/pattern, $date_string, 'pattern is captured in multi regex
when embedded with brackets');
 is(~$/patternyear, $year, 'year is captured in multi regex
when embedded with brackets');  # Fails
 is(~$/patternmonth, $month, 'month is captured in multi regex
when embedded with brackets');  # Fails
 is(~$/patternday, $day, 'day is captured in multi regex when
embedded with brackets');  # Fails
 }




-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQEcBAEBAgAGBQJVMLqGAAoJEKo+Od/eKQxFiN0IALO/O2XYMEwDabVIxQ41qBk2
npTfOPFCu/QTewHt0/rFh8ujZnx6APt5J+MDXHobB1v0E3ckMdZymsBgPSVFRYfh
XYgkWX0pelyH6Ys0M7oGEHuqZWPLavLXL5EC5gSNagKkwKdytKVlzMH+UPOEZma2
GX3GDpoCeJNuzwrACbrcwxRHYdGkaTgr19d0IyyPsGrtKKUj83yTKlb3GRPgDWUL
7g9uaIAdN87G8qvGGAdabV96gt8M0s8wRlLmKBL06q0uIs0YQvxbBLLhGrmHmX0r
4/Pc1lnS28tUdb6dfURXI3eSyFe7AmUiMnxUInojgsiJ3mQH/hmDrgOMIJTSCDE=
=K+kk
-END PGP SIGNATURE-



Re: Writing New Modules for Submission

2015-03-21 Thread Tobias Leich
Hi, a Makefile, Changelog and MANIFEST or LICENSE files belong into the
root directory, and should not be removed.
Module that you write for tests might go under t/lib. Other files like
media files that shall be installed should be in resource or share.

Am 21.03.2015 um 16:51 schrieb Tom Browder:

 The guidance for the directory layout for a proposed module is very
 clear for mandatory items, and two other directories are also
 mentioned: bin and doc.

 What about other items such as a Makefile for developer use,
 development test scripts and modules, and miscellaneous files found in
 CPAN Perl 5 modules such as TODO, Changes, and MANIFEST?  Should they
 be removed, or maybe moved to a directory hidden from the module
 ecosystem?

 Thanks.

 -Tom




Re: Object Introspection for Existence of Methods: How?

2015-03-20 Thread Tobias Leich
if $obj.^can($method_name) {...

Am 20.03.2015 um 19:38 schrieb Tom Browder:
 I am trying to create a testing subroutine to detect if a class object
 has a certain method.

 I want it to look something like this:

   my $obj = Foo.new();
   can_ok($obj, 'method1');

   sub can_ok($obj, Str $method_name) {
 if $obj.{$method_name}:exists {
   say ok;
   return True;
 }
 else {
   say not ok;
  return False;
 }
   }

 A similar function can detect valid attributes, but this or variants
 I've tried don't.

 How can I test for the existence of a method?

 Thanks.

 Cheers!

 -Tom



  1   2   >