better support for some basic stuff

9 views
Skip to first unread message

Michal Hantl

unread,
Nov 2, 2010, 11:15:09 AM11/2/10
to mi...@googlegroups.com
Hello, I was just trying to do:

request_info = [
[:AUTH_TYPE, request.getAuthType()],
[:CONTENT_TYPE, request.getContentType()],
[:CONTENT_LENGTH, request.getContentLength()],
[:PATH_INFO, request.getPathInfo()],
[:PATH_TRANSLATED, request.getPathTranslated()],
[:QUERY_STRING, request.getQueryString()],
[:REMOTE_ADDR, request.getRemoteAddr()],
[:REMOTE_HOST, request.getRemoteHost()],
[:REMOTE_USER, request.getRemoteUser()],
[:REQUEST_METHOD, request.getMethod()],
[:SCRIPT_NAME, request.getServletPath()],
[:SERVER_NAME, request.getServerName()],
[:SERVER_PROTOCOL, request.getProtocol()],
[:SERVER_POR, request.getServerPort()]
]

request_info.each { |i|
}

(since {} is broken in the Mirah version I use)

And I remembered we cannot do

if !true ... or ... if something == false and such


It would be useful to gather some "basic" stuff people might want to do.

Other stuff that comes to mind is

array.group_by, sort { |using| block }

What do you guys think?

What other use case scenarios would you like to have smoothened?

--
S pozdravem, Regards
Michal Hantl

gtalk/jabber: mic...@hantl.cz
icq: 241813215

Rib Rdb

unread,
Nov 2, 2010, 12:00:57 PM11/2/10
to mi...@googlegroups.com
On Tue, Nov 2, 2010 at 8:15 AM, Michal Hantl <michal...@gmail.com> wrote:
Hello, I was just trying to do:

   request_info = [
     [:AUTH_TYPE,      request.getAuthType()],
     [:CONTENT_TYPE,   request.getContentType()],
     [:CONTENT_LENGTH, request.getContentLength()],
     [:PATH_INFO,      request.getPathInfo()],
     [:PATH_TRANSLATED,        request.getPathTranslated()],
     [:QUERY_STRING,   request.getQueryString()],
     [:REMOTE_ADDR,    request.getRemoteAddr()],
     [:REMOTE_HOST,    request.getRemoteHost()],
     [:REMOTE_USER,    request.getRemoteUser()],
     [:REQUEST_METHOD, request.getMethod()],
     [:SCRIPT_NAME,    request.getServletPath()],
     [:SERVER_NAME,    request.getServerName()],
     [:SERVER_PROTOCOL,        request.getProtocol()],
     [:SERVER_POR, request.getServerPort()]
   ]

   request_info.each { |i|
   }

(since {} is broken in the Mirah version I use)

What's wrong with {} ? The only problem I know of was a parser bug where { :a => foo } wouldn't parse, but you could still use { a: foo }. And if you want to use the => syntax you should be able to just copy mirah-parser.jar from the latest mirah into an older version.
 
And I remembered we cannot do

   if !true ... or ... if something == false and such

Not should work in recent mirah versions.  If you're using an older version, you can always use "unless foo" instead of "if !foo"
 


It would be useful to gather some "basic" stuff people might want to do.

Other stuff that comes to mind is

  array.group_by, sort { |using| block }

You can use Collections.sort(list) {|a, b| ... }
There's also Arrays.sort, but I don't think we support converting arrays to Object[], so you'd have to use Collections.sort(Arrays.asList(array)) {...}

Michal Hantl

unread,
Nov 2, 2010, 3:41:18 PM11/2/10
to mi...@googlegroups.com
Wonderful! is this documented somewhere?

Rib Rdb

unread,
Nov 3, 2010, 3:22:19 AM11/3/10
to mi...@googlegroups.com
On Tue, Nov 2, 2010 at 12:41 PM, Michal Hantl <michal...@gmail.com> wrote:
Wonderful! is this documented somewhere?

Which one?  The java Collections and Arrays classes are in the javadocs:

The other things I mentioned are probably not documented. Please add them to the wiki at mirah.org if you think they should be :-)

Michal Hantl

unread,
Nov 3, 2010, 3:43:53 AM11/3/10
to mi...@googlegroups.com
Hmm, www.mirah.org is down.

I want to teach myself and other people Mirah so I'll need some documentation.

Maybe I'll start a wiki somewhere. We are two developers using Mirah
and we can dump some source code and HOWTOs.

We are both new to Java so everything is new to us.

I believe there are folks who take Java as a dirty word but love Ruby
and scripting languages.
Some of those will want to use GAE and Mirah is the way to go, we
should get them on board :)

Rib Rdb

unread,
Nov 3, 2010, 4:01:51 AM11/3/10
to mi...@googlegroups.com
hmm.  So much for going to bed.  mirah-lang.appspot.com is still working.
Reply all
Reply to author
Forward
0 new messages