[#405207] Does `self` and `scope(local)` operate parallels? — "Kumar R." <lists@...>

I am heavily confused with the topic when thinking `self` and `local

21 messages 2013/03/01
[#405211] Re: Does `self` and `scope(local)` operate parallels? — "Kumar R." <lists@...> 2013/03/01

Just to help experts out there I am clearing my statement once again

[#405242] Confusion in instance method calls of super class from subclass — "Kumar R." <lists@...>

I was just playing to see the instance method calls from the subclass

16 messages 2013/03/02
[#405252] Re: Confusion in instance method calls of super class from subclass — Hans Mackowiak <lists@...> 2013/03/03

YOU DID NOT READ WHAT I WAS WRITTEN:

[#405250] Extending Ruby. Little help or guidance if you are willing! — Cliff Rosson <cliff.rosson@...>

Hi Folk,

21 messages 2013/03/03
[#405393] Re: Extending Ruby. Little help or guidance if you are willing! — nannasin smith <lists@...> 2013/03/06

I've tried to do some reading but some of this is a bit over my head.

[#405549] Re: Extending Ruby. Little help or guidance if you are willing! — Cliff Rosson <cliff.rosson@...> 2013/03/10

Haven't been able to touch this in a week but I had a few minutes to look

[#405550] Re: Extending Ruby. Little help or guidance if you are willing! — Bartosz Dziewoński <matma.rex@...> 2013/03/10

On Sun, 10 Mar 2013 04:41:32 +0100, Cliff Rosson <cliff.rosson@gmail.com> wrote:

[#405600] Re: Extending Ruby. Little help or guidance if you are willing! — Cliff Rosson <cliff.rosson@...> 2013/03/11

Got ya. So it doesn't really matter if I convert things to ID and compare

[#405271] Confusion with Ruby's "case/when" block statement — "Kumar R." <lists@...>

Ruby uses `===` operator on the `case/when` type execution style.Now It

13 messages 2013/03/03

[#405310] How `next` works in ruby with `unless` ? — "Kumar R." <lists@...>

The `next` statement is used to skip a part of the loop and continue

25 messages 2013/03/04
[#405311] Re: How `next` works in ruby with `unless` ? — Joel Pearson <lists@...> 2013/03/04

Learn what semicolons do in Ruby.

[#405312] Re: How `next` works in ruby with `unless` ? — Matthew Kerwin <matthew@...> 2013/03/04

What Joel said.

[#405313] Re: How `next` works in ruby with `unless` ? — "Kumar R." <lists@...> 2013/03/04

Matthew Kerwin wrote in post #1100097:

[#405323] YourLanguageSucks — Kiswono Prayogo <kiswono@...>

Hi, i found this link.. https://wiki.theory.org/YourLanguageSucks

10 messages 2013/03/05

[#405376] When can one call themselves a “Rubyist”? — Rafal Chmiel <lists@...>

I was wondering what that term even meant. Is it something to do with

10 messages 2013/03/05

[#405400] Bignum-Fixnum-Numeric confusion — Pritam Dey <lists@...>

Hi,

13 messages 2013/03/06

[#405444] Question regarding automating some Outlook/IMAP and pdf parsing functions w/ ruby? — Ed Zimmerman <lists@...>

Hello,

20 messages 2013/03/07

[#405477] Compiling Ruby 2.0, problem with OpenSSL — "Piotr P." <lists@...>

Trying to compile Ruby 2.0 from source, having problem with it, getting

10 messages 2013/03/07

[#405495] RubyExcel class. Useful? — Joel Pearson <lists@...>

I've managed to create a (relatively) stable data-processing class which

32 messages 2013/03/08

[#405570] Confusion with block local variable declaration with block variable declaration within the pipe `|` — Love U Ruby <lists@...>

Why are we not allowed to create local variables or new object with

17 messages 2013/03/11

[#405597] Confusion with empty block printing — Love U Ruby <lists@...>

When I typed the below in my IRB:

18 messages 2013/03/11

[#405608] Access values for JSON.parse response — Nicole Villette <lists@...>

Hello, Does anyone know who to get the values from a nested hash in

17 messages 2013/03/11

[#405630] Confusion with some Module methods. — Love U Ruby <lists@...>

Can anyone help me to understand how the below module methods works?

16 messages 2013/03/12

[#405656] Confusion with Strings — Love U Ruby <lists@...>

From the book I read a line about string :

18 messages 2013/03/12

[#405762] Understanding Ruby Classes, Objects and Methods. — Kedar Mhaswade <lists@...>

Dear Rubyists,

12 messages 2013/03/13

[#405931] Finding one's way with 'super' in define_method/alias_emthod — Marcin Rzeźnicki <marcin.rzeznicki@...>

Hi all!

12 messages 2013/03/18
[#405935] Re: Finding one's way with 'super' in define_method/alias_emthod — Robert Klemme <shortcutter@...> 2013/03/18

On Mon, Mar 18, 2013 at 5:50 PM, Marcin Rze=C5=BAnicki

[#405936] Re: Finding one's way with 'super' in define_method/alias_emthod — "Marcin R." <lists@...> 2013/03/18

Robert Klemme wrote in post #1102151:

[#405942] Re: Finding one's way with 'super' in define_method/alias_emthod — Robert Klemme <shortcutter@...> 2013/03/18

On Mon, Mar 18, 2013 at 8:39 PM, Marcin R. <lists@ruby-forum.com> wrote:

[#405986] Ruby tainting on primitives — "Nicolas V." <lists@...>

Hi there,

18 messages 2013/03/20

[#405987] Why was the object_id for true and nil changed in ruby2.0? — Bharadwaj Srigiriraju <lists@...>

irb(main):001:0> true.object_id

11 messages 2013/03/20

[#406015] fixedpnt 0.0.1: Binary Fixed Point Calculations — Axel Friedrich <lists@...>

https://github.com/Axel2/fixedpnt.rb

12 messages 2013/03/20

[#406184] Nokogiri help parsing HTML — Paul Mena <lists@...>

I'm relatively new to Ruby (and therefore Nokogiri) and am trying to

18 messages 2013/03/26

[#406258] Translation Project — Jeremy Henderson <lists@...>

Hello all! This is my first post! I started learning Ruby about 3 weeks

22 messages 2013/03/28

[#406291] Hash with default — Harry Kakueki <list.push@...>

I would like to make a hash like h2 with the default described by h in one

12 messages 2013/03/29

[#406375] Ruby Gotchas presentation slides — Dave Aronson <rubytalk2dave@...>

I recently made available the slides for a presentation I did

13 messages 2013/03/30

[#406387] Private setters can be called by self, why not getters? — Josh Cheek <josh.cheek@...>

class Counter

9 messages 2013/03/31

Re: YourLanguageSucks

From: Josh Cheek <josh.cheek@...>
Date: 2013-03-05 06:12:05 UTC
List: ruby-talk #405332
On Mon, Mar 4, 2013 at 7:39 PM, Kiswono Prayogo <kiswono@gmail.com> wrote:

> Regular expressions are always in multi-line mode
> >> ?
>
>
Was this ever true? It hasn't been since I've been using Ruby (about 5
years), unless I was just too noob when I started to realize it.


> No real support for arbitrary keyword arguments (key=value pairs in
> function definitions are positional arguments with default values)
> >> ?
>
>
Deprecated as of Ruby 2.0


> The documentation is not versioned.
> >> is it?
>
>
It is:
http://ruby-doc.org/core-2.0/
http://ruby-doc.org/core-1.9.3/
http://ruby-doc.org/downloads/

Although, it's not obvious how to switch between versions at other docs
sites.


Using @ and @@ to access instance and class members can be unclear at a
> glance.
> >> no!
>
>
Frankly, I'm of the opinion that @@ should be removed altogether, it makes
no sense and is dangerous.


> There are no smart and carefully planned changes that can't break
> compatibility; even minor releases can break compatibility: See
> "Compatibility issues" and "fileutils". This leads to multiple
> recommended stable versions: both 1.8.7 and 1.9.1 for Windows. Which
> one to use?
> >>  deprecated
>
>
I don't think this is deprecated, there is nothing that I know of which
enforces this. Though people typically try to follow standards such as
http://semver.org/ to mitigate the issue.

Experimental and (known to be) buggy features are added to the
> production and "stable" releases: See "passing a block to a Proc".
> >> ?
>
>
I don't really know what this means, beyond maybe something like `lambda {
|&block| block.call }.call { 'whatever' }` in which case, I've never hit
the bug (and I do a lot of stuff like this).


> Ruby allows users to modify the built in classes, which can be useful,
> but limited namespace means addons can conflict. Experienced
> programmers know to add functionality through modules rather than
> monkey patching the built in classes, but is still prone to abuse.
> This has been promised to be resolved in ruby 2.0
> >> deprecated
>
>
Not really deprecated, there are refinements, but they're experimental, and
polarizing. There are lots of libs which litter the core classes, sadly
(I'm of the opinion that you should never do it in library code, and
generally avoid it everywhere).


> Mutable strings in a dynamic language! This means e.g. when a string
> is passed to a setter it should copy the string so the object can be
> sure that it won't change unexpectedly.
> >> ?
>
>
People complain about things like this a lot, but I've only ever ran into
issues with it once or twice so I'm not sure what they're concerned about.
Maybe I'm just more conscientious about things like this?

Mutable types like arrays are still hashable. This can cause a hash to
> contain the same key twice, and return a random value (the first?)
> when accessing the key.
> >> ?
>
>
This is true, but how frequently do you use mutable keys (and also mutate
them?) I don't think I've ever been hit by this one.


> Omitting parenthesis in function calls enable you to
> implement/simulate property setter, but can lead to ambiguities.
> >> ?
>
>
This is true, e.g.

class A
  attr_accessor :value
  def initialize
    value = 1
  end
end
A.new.value # => nil

Really, though, this is caused by the ambiguity between initialization and
assignment. What this person is complaining about here, I actually consider
a feature (it encapsulates implementation details from code that invokes
those methods, consider an alternative like JavaScript, where if you switch
from an attribute to a method, then you have to go update everything that
uses it).


> Minor ambiguities between the hash syntax and blocks (closures), when
> using curly braces for both.
> >> ?
>
>
This is still true, but pretty rare. Only really comes up for me when doing
things like RSpec let blocks, which I might have defined to return a hash
of initialization params.


> Suffix-conditions after whole blocks of code, e.g. begin ... rescue
> ... end if expr You are guaranteed to miss the if expr if there are a
> lot of lines in the code block.
> >> ?
>
>
This is true, but pretty uncommon.


> The unless keyword (=if not) tends to make the code harder to
> comprehend instead of easier.
> >> no, i guess not
>
>
I don't find this to be the case.

Difference between unqualified method calls and access of local
> variables is not obvious. This is especially bad in a language that
> does not require you to declare local variables and where you can
> access them without error before you first assign them.
> >> ?
>
>
Already addressed: I consider this a feature


> "Value-leaking" functions. The value of the last expression in an
> function is implicitly the return value. You need to explicitly write
> nil if you want to make your function "void" (a procedure).
> >> just adding nil would be find right?
>
>
This is true, but only a problem if you code in a way that I would consider
peculiar (I guess I code in such a way that things like this are just not a
problem, e.g. I minimize my public api, often to just a #call method, and
anything which leaks such a value is clearly a command and not intended to
have a return value).


> pre-1.9: No way to get stdout, stderr and the exit code (all of them
> at once) of a sub process.
> >> deprecated?
>
>
This isn't true, but it's an understandable oversight. For this, you use
the open3 stdlib (
http://ruby-doc.org/stdlib-2.0/libdoc/open3/rdoc/Open3.html), not
system/backtix/%x


> `` syntax with string interpolation for running sub processes. This
> makes shell injection attacks easy.
> >> ?
>
>
Just don't put user submitted code in backticks. It can be a little
cumbersome, but if you're passing it as an argument, you just don't
interpolate it into the string (e.g. system "ls", user_submitted_filename),
and if you do need to interpolate for some reason, there is the shellwords
stdlib for this (
http://ruby-doc.org/stdlib-2.0/libdoc/shellwords/rdoc/Shellwords.html)

Regular expressions magically assign variables: $1, $2, ...
> >> ?
>
>
This is true. I believe it comes from Perl. It's a bit awkward, but I don't
really see a problem with it.


> Standard containers (Array, Hash) have a very big interfaces that make
> them hard to emulate.
> >> emulate for what reason?
>
>
I have found this to be true, e.g.
https://github.com/JoshCheek/seeing_is_believing/blob/496c5350c1e641d9d26213af1a3ebc56b1e38205/lib/seeing_is_believing/line.rb#L12-18


> Symbols and strings are both allowed and often used as keys in hashes,
> but "foo" != :foo, which led to inventions like
> HashWithIndifferentAccess.
> >> i believe this is fine
>
>
I think this person is completely correct here, I have lost many hours to
issues stemming from this. There's even multiple implementations of
"indifferent access" hashes, which try to mitigate the issue, but really
just make it easy to lose track of what type the keys should be.

Parser errors could be more clear. "syntax error, unexpected kEND,
> expecting $end" actually means "syntax error, unexpected keyword
> 'end', expecting end of input"
> >> ?
>
>
This particular example is better in newer Rubies: "syntax error,
unexpected keyword_end", but in general, I totally agree. For example, I
think that errors like "`exit': wrong number of arguments (3 for 1)
(ArgumentError)" could be much more helpful. In one of my libs, I show the
signature if the method is incorrectly invoked
https://github.com/JoshCheek/surrogate/blob/master/lib/surrogate/argument_errorizer.rb#L16I
should probably also add the arguments.

Anyway, a pretty read. We should pay attention to things like this, it's
relevant feedback as it highlights things we've grown accustomed to, but
that stick out to newcomers.

-Josh

In This Thread