I am writing a simple, declarative programming language, intended to be used by complete beginners and experienced programmers alike. The beginners have a simpler interface for writing the code, but they should be able to read what the more experienced programmers have written. This is for a small service, similar to if this then that.

The relevant current syntax uses this format, where [words in brackets] are placeholders:

when {
  [some events]
} such that {
  [some condition]
} do {
  [some action]

The biggest problem so far is the phrase "such that". Early user testing shows that non-technical users don't understand this phrase. I can think of some alternatives that still read like written English, such as "given that" and "if", but I still think they are too technical.

These characters are whitespace: . ( ) _ [invisible characters except newline]
These characters are newline: \n , ;

Here's an example, that also illustrates multiple ways of writing newlines and whitespace:

when {
     twitter user @drathier tweets
}  such that {
     tweet.contains "fail"
} do {
     email.send {
          to: [email protected];
          subject: "new tweet from {{tweet.author}}",
          message: {{tweet message}}

The reasoning behind allowing multiple common kinds of syntax is that whatever the user writes, should probably work. Syntax can be normalized automatically in hindsight, if we want to.

How can I modify the syntax to make it more readable by non-technical users?

  • Technical users or not - I see why people don't get 'such that' - it is simply not used that much in daily language. Programming has got some strict logic foundation, I wouldn't try to reinvent the wheel. By 'such that' do you really mean 'and'?
    – Izhaki
    Dec 26, 2015 at 17:27
  • It is not the same as and. I want to separate event listener declaration from the filters, to keep the code simpler, but maybe that's a bad idea? The closest thing to what I mean with them separated that I can think of in a common language is the where in an sql query, that separates where the data we want is, from what subset of that data we want. Dec 26, 2015 at 17:44
  • "In which" or "for which" would be a little more intuitive while meaning the same thing, but they still might not be great.
    – octern
    Dec 26, 2015 at 22:20
  • I am no native speaker so I can't contribute ontopic, but please post here when you release your project! I've been waiting for something like this forever!
    – Zoe K
    Dec 30, 2015 at 5:28

4 Answers 4


My instinct is to rephrase it:

When [event occurs]

If [condition is true]

Do [action]

Though, for a technical audience, perhaps "Given, When, Then" (borrowed from test design/user story creation) is worth a thought!

Given [a context]

When [condition is true or actions are performed]

Then [perform action/test outcome of actions]

There is no programming language that uses 'such that' as an expression. Not in declarative, scripting or complied code.

Usually declarative languages uses a different syntax. Querying a database is a declarative language which uses the following keywords:

   [expression is true]

Such that would be equal to the where-clause. And this can be translated to natural language as: Give me the blue socks from the second drawer. In declarative language this would be:

   [color = blue] and
   [drawer = second]

Such that doesn't exist in declarative language. What you're trying to show is where.

  • 1
    Love the fact that "where" is both applicable in natural language and precedented in another major, high-level language. Since SQL has been around for so long, I imagine there's already been some research on whether new users find its "where" construct intuitive.
    – octern
    Dec 26, 2015 at 22:19
  • I think we can do better than SQL. select blue socks from second_drawer would read better, for example. Would removing the where clause and putting that information elsewhere make it easer for a human to write/read? It would definitely make it harder for a computer to parse, but that's not relevant here. Dec 27, 2015 at 9:46
  • 1
    @FilipHaglund I agree it's better SQL, but the goal of the answer was to show what 'such that' could be replaced with. :) Dec 27, 2015 at 9:49
  • I think when {} where {} do {} sounds worse, though. Did you have any change of word/clause order in mind? Dec 27, 2015 at 10:02

How about for the complete beginner:

when { [some events] } and the following becomes true { [some condition]...


Why not simpify it to

If (not twitter.user(@drathier).tweets)
          email.send {
               to: [email protected];
               subject: "new tweet from {{tweet.author}}",
               message: {{tweet message}}

Where if it dosent return with a valid tweet or fail then the if stamement is executed? From a programmer stand point "when{} suchthat{} do{}" doesn't make sense.

  • I disagree strongly. The Select -> Filter -> Process workflow is a really common programming solution for this operation. It makes considerably more sense than your proposed solution.
    – Racheet
    Dec 30, 2015 at 11:45
  • 2
    I don't understand your proposed conditions - If (not twitter.user(@drathier).tweets) triggers an action when a user doesn't tweet? Or when anybody other than that particular person tweets? Or something else?
    – kwah
    Dec 30, 2015 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.