Skip to content

Commit

Permalink
Removed the ¦ alias for the pair ":" operator. (too ugly)
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Aug 3, 2020
1 parent d39680e commit 1e250bc
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 19 deletions.
7 changes: 1 addition & 6 deletions lib/Sidef/Object/Object.pm
Original file line number Diff line number Diff line change
Expand Up @@ -390,16 +390,11 @@ package Sidef::Object::Object {
Sidef::Types::Array::Pair->new($_[0], $_[1]);
};

# TODO: v4.0: the following 2 methods should create an Array with 2 elements
# Pair (2-Array) method: Fullwidth Colon; U+FF1A
# Pair method: Fullwidth Colon; U+FF1A
*{__PACKAGE__ . '::' . ''} = sub {
Sidef::Types::Array::Pair->new($_[0], $_[1]);
};

# Pair (2-Array) method: Broken bar; U+A6
# Easier to type than U+FF1A, but uglier
*{__PACKAGE__ . '::' . '¦'} = \&{__PACKAGE__ . '::' . ''};

# NamedParam method: Triple Colon Operator; U+2AF6
*{__PACKAGE__ . '::' . ''} = sub {
Sidef::Variable::NamedParam->new($_[0], $_[1]);
Expand Down
10 changes: 4 additions & 6 deletions lib/Sidef/Object/Object.pod
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,17 @@ Return the

=cut

=head2 ¦
=head2

I<Obj> B<¦> I<Obj> -> I<Obj>
I<Obj> B<> I<Obj> -> I<Obj>

Return the

Aliases: I<:>

=cut

=head2
=head2

I<Obj> B<> I<Obj> -> I<Obj>
I<Obj> B<> I<Obj> -> I<Obj>

Return the

Expand Down
2 changes: 1 addition & 1 deletion lib/Sidef/Parser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ package Sidef::Parser {
!= ..
\\\\= \\\\
!! !
: : ⫶ ¦
: : ⫶
« » ~
);

Expand Down
8 changes: 8 additions & 0 deletions lib/Sidef/Sys/Sys.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ package Sidef::Sys::Sys {
(Time::HiRes::ualarm($sec)) ? (Sidef::Types::Bool::Bool::TRUE) : (Sidef::Types::Bool::Bool::FALSE);
}

*micro_alarm = \&ualarm;

sub sleep {
my ($self, $sec) = @_;

Expand All @@ -60,18 +62,24 @@ package Sidef::Sys::Sys {
(Time::HiRes::nanosleep($sec)) ? (Sidef::Types::Bool::Bool::TRUE) : (Sidef::Types::Bool::Bool::FALSE);
}

*nano_sleep = \&nanosleep;

sub usleep {
my ($self, $sec) = @_;

state $x = require Time::HiRes;
(Time::HiRes::usleep($sec)) ? (Sidef::Types::Bool::Bool::TRUE) : (Sidef::Types::Bool::Bool::FALSE);
}

*micro_sleep = \&usleep;

sub osname {
my ($self) = @_;
Sidef::Types::String::String->new($^O);
}

*os = \&osname;

sub user {
my ($self) = @_;
Sidef::Types::String::String->new(CORE::getlogin);
Expand Down
16 changes: 12 additions & 4 deletions lib/Sidef/Sys/Sys.pod
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,14 @@ Return the

=cut

=head2 nanosleep
=head2 nano_sleep

Sys.nanosleep() -> I<Obj>
Sys.nano_sleep() -> I<Obj>

Return the

Aliases: I<nanosleep>

=cut

=head2 open
Expand All @@ -304,12 +306,14 @@ Return the

=cut

=head2 osname
=head2 os

Sys.osname() -> I<Obj>
Sys.os() -> I<Obj>

Return the

Aliases: I<osname>

=cut

=head2 print
Expand Down Expand Up @@ -516,6 +520,8 @@ Sys.ualarm() -> I<Obj>

Return the

Aliases: I<micro_alarm>

=cut

=head2 umask
Expand Down Expand Up @@ -550,6 +556,8 @@ Sys.usleep() -> I<Obj>

Return the

Aliases: I<micro_sleep>

=cut

=head2 wait
Expand Down
3 changes: 1 addition & 2 deletions scripts/Tests/pair_namedparam_force_ops.sf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ assert_ne(n: 2 -> dump, (n): 2 -> dump)
assert_eq((n): 2 -> dump, 1: 2 -> dump)
assert_eq(n:2, Pair(1, 2))
assert_eq(1:2, 1+2i)
assert_eq(1 2, Pair(1, 2))
assert_eq(1¦ 2, Pair(1, 2))
assert_eq(1:2, Pair(1, 2))

say "** Test passed!"

0 comments on commit 1e250bc

Please sign in to comment.