gavr123456789 / Niva

Smalltalk like programming language
https://gavr123456789.github.io/niva-site
43 stars 2 forks source link

Return value of lambdas as return types is not checked #243

Open gavr123456789 opened 4 months ago

gavr123456789 commented 4 months ago
union CombinatorResult = 
| Success value: String rest: String captures: MutableMap(String, String)
| Failure

type Parser
type ParserCombinator = [String -> CombinatorResult]

Char parse -> ParserCombinator = ^ [str::String ->  // SHOULD BE AN ERROR lambda must return CombinatorResult

]
gavr123456789 commented 4 months ago

Actually this:

Char parse -> ParserCombinator = ^ [str::String -> 
  str isEmpty && (str first == this)
]

returns error as exppected, so the main problem is that empty bloc... has Unit type?