Oct. 6th, 2016

juan_gandhi: (VP)
Playing with Java. С местным Чабой тоже собачусь, осторожненько. Он (Клиф Клик), конечно, титан, но тупой, весь такой из 85-го года, си на восьмибитном процессоре - это то, на чем он учился программировать. Кругом у него байтовые массивы, и он думает, что круто. Лезет с хуйней.

Ok, whatever. I just remember how class serialization/deserialization was so much of a trouble. But now, wow, I have a class, turn it into bytes, pass to another node, where I convert it back to Function<X,Y> - and then I call it.

  public void testDeserializationAndEval() throws Exception {
    byte[] bytes = readHex(sampleCode);
    Class c = loadClass("water.util.SampleClosure", bytes);
    assertEquals("X=42", evalFunction(c, 42));
  }

  String sampleCode = 
                  "ca fe ba be 00 00 00 33 00 2d 0a 00 0b 00 1d 07 \n" +
                  "00 1e 0a 00 02 00 1d 08 00 1f 0a 00 02 00 20 0a \n" +
...


(you probably recognize "cafebabe", right?)

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

August 2025

S M T W T F S
      12
3456789
10 11 12 13141516
171819 20212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 21st, 2025 09:02 am
Powered by Dreamwidth Studios