juan_gandhi: (VP)
[personal profile] juan_gandhi
(fixed)

type Outcome = Result[Any]

val OK:Outcome = Good("OK")


Turned out, have tons of it everywhere. Weird actually.

And no, I'm not saying it's good. I'm just seeing a pattern that worries me a little bit, but I don't know why.

E.g.
  def executeJS(js: String): Result[Unit] = runJS(js) map asScala filter
    ("OK"==, wrong => s"Wrong response from browser: <<$wrong>>")

Date: 2014-03-10 08:29 pm (UTC)
From: [identity profile] ivan-gandhi.livejournal.com
E.g.
    OK.
      filter(_ => waitSelector(tag, DefaultInitialDelay, timeout), s"The page with $tag did not load").
      filter((_:String) => isPresent(tag),   s"Wrong page, could not find $tag").
      andThen (loadJavaScriptLibrary)
Edited Date: 2014-03-10 08:30 pm (UTC)

Date: 2014-03-10 08:37 pm (UTC)
From: [identity profile] eliah lakhin (from livejournal.com)
Не понял все-таки, зачем строковый параметр.

Вообще, я с некоторого момента перестал сильно заморачиваться с типами для констант, и начал просто пихать везде строковые литералы, даже не Symbol. Безобразие, конечно. Но Скала в целом какой-то немного кривоватый язык, мне кажется, располагает к вольностям иногда.

Date: 2014-03-10 08:45 pm (UTC)
From: [identity profile] ivan-gandhi.livejournal.com
Вот это-то меня и смущает.

Есть два варианта - один - Good(content), другой - "всё хорошо"; я бы написал Good[Unit]... да впрочем, вот и ответ, наверное.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

May 2025

S M T W T F S
    1 2 3
456 7 8 9 10
11 121314151617
181920 21 222324
25 262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 28th, 2025 06:24 pm
Powered by Dreamwidth Studios