Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
Java web vs Phemme
package something;
import javax.servlet.ServletException;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.annotation.WebServlet;
public class FeedServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) {
res.addHeader("Content-Type", "text/html; charset=utf-8");
String name = req.getParameter("name");
res.getWriter().write(...); // You'd have this in a separate layer, e.g.: JSP
-- Nodes are first class, all of these stuff are objects
let hello = |name| =>
<title>"Hello, " name</title>
<h1>"Hello, " name</h1>
`/ get: |req| =>
-- This is not text, it's all objects, it'll yell at you if you get anything wrong
Status: 200
Content-Type: "text/html" Charset: "utf-8";
Body: hello req/params/name
-- Since all those headers are the default, you can just have:
-- `/ get: |req| => Body: hello req/params/name
Copy link

rafaelcn commented May 6, 2014

Which one to choose? That's so difficult!11!1! hahaha :v

Copy link

haskellcamargo commented Jul 2, 2014

The cool of Phemme is that we now can write HTML inside the own language, no need to specify a block for it. We can just mix both them, different of PHP, where we always must to close the current block '?>' and write the HTML or give an 'echo'|'print' to the code. Whitespace strictness is good for me 😄 But you can't forget about multiple inheritance! Traits, Mixis, both them are valid ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment