Skip to content

Commit

Permalink
- Method aliases clean-up.
Browse files Browse the repository at this point in the history
1. Removed the camelCase method aliases. All methods will now follow the underscore-separator philosophy.
2. Changed the behavior of some methods.
3. Merged similar methods together.

- The most important changes are the following:

* Regex.matches() is available only as Regex.match()
* Array<<() and Array>>() no longer shift the array;
    * Array<<()  ==  Array.push()
    * Array>>()  ==  Array.assign_to()
* Array.assign_to() now removes the elements from the array.
* Added the Array.remove_last(obj) method to remove that last object from the array
* Ref.\() can now take a reference to Magic variables, like "$?", "$/", etc...
  • Loading branch information
trizen committed Sep 15, 2015
1 parent ee8054e commit 19ab31b
Show file tree
Hide file tree
Showing 64 changed files with 370 additions and 813 deletions.
8 changes: 2 additions & 6 deletions lib/Sidef/Convert/Convert.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,19 @@ package Sidef::Convert::Convert {
: $self;
}

*to_str = \&to_s;
*to_string = \&to_s;
*to_str = \&to_s;

sub to_obj {
my ($self, $obj) = @_;
return $self if ref($self) eq ref($obj);
$obj->new($self);
}

*to_object = \&to_obj;

sub to_i {
Sidef::Types::Number::Number->new_int($_[0]->get_value);
}

*to_integer = \&to_i;
*to_int = \&to_i;
*to_int = \&to_i;

sub to_rat {
Sidef::Types::Number::Number->new_rat($_[0]->get_value);
Expand Down
2 changes: 0 additions & 2 deletions lib/Sidef/Math/Math.pm
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ package Sidef::Math::Math {
Sidef::Types::Number::Number->new(($from + $to) * (($to - $from) / $step + 1) / 2);
}

*rangeSum = \&range_sum;

sub map {
my ($self, $value, $in_min, $in_max, $out_min, $out_max) = @_;

Expand Down
13 changes: 3 additions & 10 deletions lib/Sidef/Math/Math.pod
Original file line number Diff line number Diff line change
Expand Up @@ -572,18 +572,11 @@ Return the

=cut

=head2 rangeSum
=head2 range_sum

Math.rangeSum(I<from>, I<to>, I<step>) -> I<Num>
Math.range_sum() -> I<Obj>

Returns the sum for a given range of numbers and an optional step.

Math.rangeSum(1, 9); # returns: 45 (1+2+3+...+9)
Math.rangeSum(1, 9, 2); # returns: 25 (1+3+5+...+9)

Aliases: I<range_sum()>.

Returns an object of type: C<Sidef::Types::Number::Number>
Return the

=cut

Expand Down
4 changes: 0 additions & 4 deletions lib/Sidef/Sys/Sys.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ package Sidef::Sys::Sys {
Sidef::Types::Bool::Bool->new(Time::HiRes::nanosleep($sec->get_value));
}

*nanoSleep = \&nanosleep;

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

Expand All @@ -55,8 +53,6 @@ package Sidef::Sys::Sys {
Sidef::Types::String::String->new($^O);
}

*osName = \&osname;

sub user {
my ($self) = @_;
Sidef::Types::String::String->new(CORE::getlogin);
Expand Down
15 changes: 3 additions & 12 deletions lib/Sidef/Sys/Sys.pod
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,6 @@ Sys.nanosleep() -> I<Obj>

Return the

Aliases: I<nanoSleep>

=cut

=head2 open
Expand All @@ -305,18 +303,11 @@ Return the

=cut

=head2 osName

Sys.osName() -> I<String>

Return the name of the current operating system under which Sidef is running.
=head2 osname

Sys.osName # 'linux' under Linux
# 'MSWin32' under Windows
Sys.osname() -> I<Obj>

Aliases: I<osname()>.

Returns an object of type: C<Sidef::Types::String::String>
Return the

=cut

Expand Down
3 changes: 0 additions & 3 deletions lib/Sidef/Time/Gmtime.pm
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@ package Sidef::Time::Gmtime {
*minute = \&min;
*second = \&sec;
*month_day = \&mday;
*monthDay = \&mday;
*week_day = \&wday;
*weekDay = \&wday;
*year_day = \&yday;
*yearDay = \&yday;
}

sub ctime {
Expand Down
3 changes: 0 additions & 3 deletions lib/Sidef/Time/Localtime.pm
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@ package Sidef::Time::Localtime {
*minute = \&min;
*second = \&sec;
*month_day = \&mday;
*monthDay = \&mday;
*week_day = \&wday;
*weekDay = \&wday;
*year_day = \&yday;
*yearDay = \&yday;
}

sub ctime {
Expand Down
Loading

0 comments on commit 19ab31b

Please sign in to comment.