Skip to content

Add convenience attribute operator to NodeSeq #1679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2012

Conversation

rtyley
Copy link
Contributor

@rtyley rtyley commented Nov 27, 2012

Compared to the current method of reading the string text of an attribute:

(x \ "@bar").text

...the new operator removes the need for a pair of parenthesis and shortens the overall expression by 7 chars :

x \@ "bar"

Discussion on scala-internals:

https://groups.google.com/d/topic/scala-internals/BZ-tfbebDqE/discussion

Review by @phaller

Compared to the current method of reading the string text of an
attribute:

(x \ "@bar").text

...the new operator removes the need for a pair of parenthesis and
shortens the overall expression by 7 chars :

x \@ "bar"



Discussion on scala-internals:

https://groups.google.com/d/topic/scala-internals/BZ-tfbebDqE/discussion
@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1743/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1743/

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1032/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1032/

@soc
Copy link
Contributor

soc commented Nov 28, 2012

What about \\@?

@rtyley
Copy link
Contributor Author

rtyley commented Nov 28, 2012

@soc interesting question - \\@ would mean 'give me the (concatenated or traversable?) values of every attribute with this name under the current nodeseq' - although it could be a useful shortcut, I typically wouldn't read the value of an attribute without first knowing the name of the element it belonged to.

For me, this means that although I feel comfortable with \@, I would rather not have \\@ included.

@rtyley
Copy link
Contributor Author

rtyley commented Nov 28, 2012

btw, I have mailed a signed copy of the Scala CLA to Danielle Chamberlain.

@adriaanm
Copy link
Contributor

adriaanm commented Dec 6, 2012

ping @phaller

@phaller
Copy link
Contributor

phaller commented Dec 13, 2012

LGTM

adriaanm added a commit that referenced this pull request Dec 14, 2012
Add convenience attribute operator to NodeSeq
@adriaanm adriaanm merged commit 22ed6d4 into scala:master Dec 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants