Skip to content

Conversation

devinus
Copy link
Contributor

@devinus devinus commented Mar 1, 2013

As discussed previously in #501, %w can now return a few core data types other than just binaries (extendible to support further types in the future without breaking backwards compatibility). My enthusiasm for this jumped ten-fold now that I'm writing things that could be written like this:

fields %w(
  contact_id
  contact_guid
  brand_id
  title
  first_name
  middle_name
  last_name
  suffix
  eligibility_mask
  username
  user_password
  dob
  gender
  passport_country
  password_number
)a

@yrashk
Copy link
Contributor

yrashk commented Mar 1, 2013

👍 👍 👍

@meh
Copy link
Contributor

meh commented Mar 1, 2013

Nice stuff 👍

@@ -3150,6 +3150,51 @@ defmodule Kernel do
Macro.escape(regex)
end

@doc """
Handles the sigil %w. It returns a list of "words" split by whitespace.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: backticks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexrp On %w ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexrp I thought so too but I was mimicking the other sigil @doc's. Lets add backticks for all of them in a separate patch.

@josevalim
Copy link
Member

String.split was merged. Maybe we could get rid of String.split_words and just call String.split or lc(part inlist String.split(...), do: ...) depending on the modifier?

@yrashk
Copy link
Contributor

yrashk commented Apr 11, 2013

@devinus bump?

@devinus
Copy link
Contributor Author

devinus commented Apr 11, 2013

@yrashk Yep, today.

@devinus
Copy link
Contributor Author

devinus commented Apr 12, 2013

@josevalim @yrashk All suggestions implemented. I like this version a lot.

josevalim pushed a commit that referenced this pull request Apr 12, 2013
Add support for %w and %W (words) sigils with return type modifiers
@josevalim josevalim merged commit d3238b8 into elixir-lang:master Apr 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants