Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
By Étienne Barrié Ruby has slowly but surely added support for keyword arguments. Starting from the implicit braces for a hash at the end of an argument list, it has grown up to required keyword arguments in 2.1. This talk will try to convince you that keyword arguments are a lie and don't even exist, and why you should use them anyway. Help us caption & translate this video! http://amara.org/v/H4Od/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the talk titled "Ruby keyword args and the options hash, from the parser to the virtual machine" presented by Étienne Barrié at ArrrrCamp 2015, the speaker delves into the evolution and utilization of keyword arguments in Ruby. The presentation begins by establishing that keyword arguments were introduced gradually into Ruby, starting from the basic options hash to the more sophisticated support in later versions. Key points discussed include: - **Definition of Keyword Arguments**: Keyword arguments allow function calls to explicitly state the name of each parameter, enhancing readability and reducing confusion when passing multiple arguments. - **Advantages of Keyword Arguments**: - They make code more readable and maintainable by eliminating the need to remember the order of parameters. - Easier to manage changes in method definitions, particularly when adding or removing parameters. - **Positional vs. Keyword Arguments**: Barrié compares positional arguments, which can lead to confusion especially in method calls spread across different files, with keyword arguments that provide clarity. - **Options Hash**: Before keyword arguments were officially introduced, Ruby developers often used an options hash to simulate keyword arguments, allowing for more descriptive and flexible method calls. - **Evolution of Keyword Arguments in Ruby**: - Over time, Ruby incorporated directives that simplify the usage of keyword arguments, such as optional keyword arguments and the double splat operator to handle remaining arguments. - The introduction of required keyword arguments in Ruby 2.1 was highlighted as a significant upgrade, improving both functionality and developer experience. - **Implementation Details**: The talk touches on the complexity of Ruby's handling of keyword arguments and highlights some potential performance pitfalls compared to traditional method calling. - **Demonstrations of Errors**: Practical examples are provided to illustrate common pitfalls when using keyword arguments, emphasizing the need for careful coding practices to avoid typical mistakes, especially with empty hashes and typos. Through the presentation, Barrié argues that while keyword arguments improve efficiency in coding, they fundamentally do not exist in Ruby in the same way that they might in other programming languages such as Python. The conclusion rests on the idea that the semantics of keyword arguments could still be refined further in future Ruby versions, enhancing their utility without the need for cumbersome workarounds. Overall, the talk emphasizes the tradeoffs associated with keyword arguments and the importance of understanding their implementation in Ruby's architecture, ultimately promoting their usage while acknowledging their limitations and quirks.
Suggest modifications
Cancel