News for hackers. Stuff that matters.
Re:Red Engine: modern scheduling framework for Python applic... by nerdponx on Sunday July 03, 2022 @02:03PM (#31969654)
> Clean: Scheduling is just plain English

Ugh, no thanks.

First of all, English itself is not clean; it's a messy amalgamation of special cases and inconsistent spelling rules.

Second, it isn't actually English anyway. It might look like English, but it's actually a DSL that happens to correspond to English a lot of the time. English text is meant to be interpreted by humans, who understand context & connotation, and can resolve ambiguities by making educated guesses or discussing the text with other humans. But your English-like DSL can only be interpreted by a computer program, which cannot (and arguably should not) do such things. Ergo, the benefits of using natural language are lost, and you are left with the same strict interpretation rules as any other programming language, but without any of the syntactic rigor that would normally help you construct programs/expressions that are both syntactically correct and also do what you intended them to do. Finally, the passing similarity to another language is a newbie trap and it makes teaching more difficult. See also: SQL, Python.

Worse still, it's represented in code as a string literal. It cannot be reasonably syntax-highlighted or otherwise statistically analyzed, nor can it be easily constructed dynamically if needed, nor can scheduling primitives be combined or composed. It is the worst of all worlds, and you have no way to check if your program is valid other than to run it and see if it crashes. And you have to re-learn operator precedence / associativity rules, because they probably won't be identical to the rules in Python itself.

I'm sorry if there is a really high quality scheduling engine underneath this DSL, but I absolutely would never want to use something like this in production code.

(I'm sure you can guess how I feel about BDD frameworks and "expect.foo.to.be.equal.to" style test APIs).

Re:Red Engine: modern scheduling framework for Python applic... by Groxx on Sunday July 03, 2022 @02:16PM (#31969763)

    @app.task('daily & is foo', execution="process")
followed by

    @app.task("after task 'do_daily'")
Yeah, I did a hard turn towards "nope" right there.

Similar but not quite Python combined with similar but not quite English does not make a tasty dish. It makes yet another pointless one-off thing to learn and struggle with.

Re:Red Engine: modern scheduling framework for Python applic... by nerdponx on Sunday July 03, 2022 @02:26PM (#31969840)
These in particular remind me of "Baba Is You", which is probably not a good thing for an API.
Re:Red Engine: modern scheduling framework for Python applic... by aeyes on Sunday July 03, 2022 @03:23PM (#31970243)
For some reason they chose to put the concept which is hardest to understand on the front page. 'is foo' is showing how to define and use a custom condition, the conditions in the rest of the documentation are easy to understand and make sense to me.

The only way I could see me struggle with this would be to piece together a large call graph in my head. I can understand why the author says that Airflow is better suited for this case because you get a visualization.

Re:Red Engine: modern scheduling framework for Python applic... by elcapitan on Sunday July 03, 2022 @03:08PM (#31970138)
Just got hard AppleScript PTSD.
Re:Red Engine: modern scheduling framework for Python applic... by OJFord on Sunday July 03, 2022 @03:06PM (#31970120)
It's also just annoyingly redundant, and breaks searching, completion, etc.:

    @app.cond('is foo')
    def is_foo():
IMO

    @app.cond
    def is_foo():
And 'losing' that you can omit the underscore to make it look a bit like English is much better. Plus then I can jump from its use back to this definition without any DSL-aware tooling (that probably doesn't exist).
Re:Red Engine: modern scheduling framework for Python applic... by klysm on Sunday July 03, 2022 @02:22PM (#31969805)
The mistake of trying to make programming languages look like English looks like it will be repeated forever. English is not a good language for expressing things specifically to computers or other humans for that matter.
Re:Red Engine: modern scheduling framework for Python applic... by keredson on Monday July 04, 2022 @02:49AM (#31974190)
100%. also, why re-invent python's already pretty decent datetime/timedeltas?

and why not a proper python DSL?

  from redengine import minute, hour
  
  @app.run_every(hour + 20*minute)
  def do_first(): [...]
  
  @app.run_after(do_first)
  def do_second1(): [...]
  
  @app.run_after(do_first)
  def do_second2(): [...]
  
  @app.run_after(do_second1 and do_second2)
  def do_last(): [...]
Re:Red Engine: modern scheduling framework for Python applic... by mft_ on Sunday July 03, 2022 @04:04PM (#31970558)
It’s plain English like SQL is plain English. It uses English words that’s kind-of make sense to a novice, but that doesn’t stop it being a new programming language.
Re:Red Engine: modern scheduling framework for Python applic... by Volker_W on Sunday July 03, 2022 @04:14PM (#31970636)
> See also: SQL, Python

I do not see what is wrong with SQL and I definitely do not see what is wrong with Python.

Re:Red Engine: modern scheduling framework for Python applic... by New_California on Sunday July 03, 2022 @02:30PM (#31969868)
You nailed it.