Comment

Comment by crntaylor

> Being able to create something of a DSL and map your business rules onto basic operations on this DSL is a huge win.

Hold on - how is this a concept specific to object-oriented programming? Creating a DSL for your problem domain and solving the problem in the new language is exactly what functional programmers have been doing for decades! E.g. here's a mini-DSL in Haskell for parsing CSVs, built on top of the Parsec parsing DSL:

    cellContents = many (noneOf ",\n")    -- match up to first comma/newline
    
    remainingCells = (char ',' >> cells)  -- comma => parse more cells
                 <|> (return [])          -- else done

    cells = do first <- cellContents
               rest <- remainingCells
               return (first : rest)

    eol = char '\n'                       -- match newline character

    line = do result <- cells
              eol
              return result
Building DSLs is most emphatically not something specific to OO programming.
parent crntaylor 14 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton