# I am the Watcher. I am your guide through this vast new twtiverse.
#
# Usage:
# https://watcher.sour.is/api/plain/users View list of users and latest twt date.
# https://watcher.sour.is/api/plain/twt View all twts.
# https://watcher.sour.is/api/plain/mentions?uri=:uri View all mentions for uri.
# https://watcher.sour.is/api/plain/conv/:hash View all twts for a conversation subject.
#
# Options:
# uri Filter to show a specific users twts.
# offset Start index for quey.
# limit Count of items to return (going back in time).
#
# twt range = 1 9
# self = https://watcher.sour.is/conv/4pqlhiq
@prologic I don't like it either. Too much magic, that only works in certain cases.
@lyse one time i saw that operator when working with ruby on rails and i was so confused by it that i got stuck on the same code involving it for 9 hours straight
@lyse one time i saw that operator when working with ruby on rails and i was so confused by it that i got stuck on the same code involving it for 9 hours straight
@kat You mean the ?
as suffix for boolean returning functions or as ternary operator (condition ? true_value : false_value
)?
Interestingly, I just had to look up the first case. I was under the wrong impression that the question mark at the end would be some shortcut for chained function or method calls that handles nil
return values in a graceful way without actually dereferencing and thus crashing. I probably never wrote more than 30Β lines of Ruby in my entire life. Must have been some other language.
@lyse Ita a terrible operator that makes code hard
Yo read as @kat difhtidu points out π
@lyse Ita a terrible operator that makes code hard
Yo read as @kat difhtidu points out π
@prologic Which one? I don't mind the ternary operator at all. In fact, I often find myself missing it in Go. I don't find the two alternatives particularly elegant:
foo := "eggs"
if bar {
foo = "spam"
}
Or:
var foo string
if bar {
foo = "spam"
} else {
foo = "eggs"
}
To my eye, this just would look a lot nicer:
foo := bar ? "spam" : "eggs"
Or at least as the Pythons do it:
foo = "spam" if bar else "eggs"
The ternary operator especially shines with relatively short expressions.