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:18 pm (UTC)
From: [identity profile] showpoint.livejournal.com
Масло масляное. И зачем оно?

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

June 2025

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 2nd, 2025 11:38 am
Powered by Dreamwidth Studios