3 ms·
Here's what kc3 code looks like (taken from [1]): def route = fn (request) { if (request.method == GET || request.method == HEAD) do
by tromp 2y ago
Here's what kc3 code looks like (taken from [1]):
def route = fn (request) {
if (request.method == GET ||
request.method == HEAD) do
locale = "en"
slash = if Str.ends_with?(request.url, "/") do "" else "/" end
path_html = "./pages#{request.url}#{slash}index.#{locale}.html"
if File.exists?(path_html) do
show_html(path_html, request.url)
else
path_md = "./pages#{request.url}#{slash}index.#{locale}.md"
if File.exists?(path_md) do
show_md(path_md, request.url)
else
path_md = "./pages#{request.url}.#{locale}.md"
if File.exists?(path_md) do
show_md(path_md, request.url)
end
end
end
end
}
[1] https://git.kmx.io/kc3-lang/kc3/_tree/master/httpd/page/app/controllers/page_controller.kc3 https://git.kmx.io/kc3-lang/kc3/_tree/master/httpd/page/app/...
- cgh 2y agoYeah, I'm not sure a lot of people read the article. This isn't really a back to basics, going back to C, forgoing complexity type of article, but instead it's about developing a new programming language called KC3 to make use of ideas he originally developed in Lisp.
- jkhdigital 2y agoThe author mentions being deeply inspired and influenced by Jose Valim; I guess this means (approximately) that KC3 is to C as Elixir is to Erlang?
- relistan 2y agoMaybe early return isn’t allowed in that language, but it sure would make that a heck of a lot easier to read.