Questions tagged [reify]

To "reify" means to take an abstract concept and make a concrete representation out of it. For example, in Lisp lambdas allow you to reify the concepts of procedure abstraction and application.

30 questions
3
votes
2 answers

Mocking existing methods in Clojure

I am trying to use with-redefs and reify to mock methods in clojure. I do not have a clue on where to get started with those. Can anyone please give me an example of mocking a method? The documentation on the internet is of no help for me as I am…
srnvs
  • 997
  • 2
  • 10
  • 22
2
votes
1 answer

Dynamic let form as part of reify within a macro

Ok, let's try to get this straight: my final intent is to provide a macro as an API to users which will look like: (defscript [a b] (println a)) The result has to be an instance of a Script protocol, which looks like: (defprotocol Script (run…
skuro
  • 13,414
  • 1
  • 48
  • 67
2
votes
1 answer

One-off instances created with reify cause NPE

I'm trying to write a Clojure layer around a Java API that looks like the following: public class Executor { public interface ExecutorJob { public Result execute () throws Exception; } public static R…
skuro
  • 13,414
  • 1
  • 48
  • 67
2
votes
1 answer

Meteor - IE11 displays a blank page

I get this error under IE11: object doesn't support this property or method "for" on line: var esSymKey = useSymbol ? Symbol.for(esStrKey) : null; from node_modules/meteor/modules/node_modules/reify/lib/runtime/utils.js in modules.js. I tried to…
Louis XIV
  • 2,224
  • 13
  • 16
2
votes
2 answers

How to deserialise a JSON where the corresponding Haskell type is available during runtime as a value?

I'm trying to implement a port of DelayedJob (from the Rails world) in Haskell. Here's the typeclass I have which represents a DelayedJob class (FromJSON j, ToJSON j, FromJSON r, ToJSON r) => DelayedJob j r | j -> r where serialise :: j -> Value …
Saurabh Nanda
  • 6,373
  • 5
  • 31
  • 60
2
votes
0 answers

Feedback of "reify"

I am new here, so please forgive me if this type of post/question is inappropriate here. Does anyone have used Isomorphic Reify (http://www.smartclient.com/product/reify.jsp)? On "paper" the solution looks promising, but I'd like real field…
jgp
  • 2,069
  • 1
  • 21
  • 40
1
vote
1 answer

Kotlin reify is not getting the actual instance type

I'm trying to implement a ValueObject base class using Kotlin and DDD. As any value object must consider all attributes in the equals method, I decided to implement a single method using reflection, so no subclass will need to implement it. My…
1
vote
0 answers

Dynamically generating a reify clause using macros

I am trying to wrap an implementation and dynamically generate the reify clause for all the interfaces the wrapped object implements. For example: I want to generate: (reify BaseInterface (fee [_] (custom-operation wrapped)) (foo [_]…
shams
  • 3,460
  • 24
  • 24
1
vote
1 answer

How to call a reified Java interface from a class in Clojure? Call can't be resolved

I am trying to translate some Java code directly into Clojure on a raspberry pi. I am stuck at implementing an interface in a method call - addListener. I have tried using reify, proxy, and deftype. With reify I have tried providing as many hints to…
byrongibby
  • 55
  • 1
  • 7
1
vote
1 answer

Clojure extend Assotiative arity

I need to implement custom assoc, but it does not work with multiple arguments. It processes only first pair. It seems that it calls assoc directly, not via core assoc and then RT/assoc. (def my-assoc (reify clojure.lang.Associative …
uNmAnNeR
  • 600
  • 5
  • 12
1
vote
2 answers

TypeTag for case classes

I would like to make a case class Bla that takes a type parameter A and it knows the type of A at runtime (it stores it in its info field). My attempt is shown in the example below. The problem is that this example does not compile. case class…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
1
vote
2 answers

StackOverflowError during macro expansion of reify

I have a simple test macro that uses reify. It causes a StackOverflowError during macro expansion. def test() = macro testimpl def testimpl(c:Context)():c.Expr[Any] = { import c.universe._ val o = reify { // StackOverflowError here object…
Kim Stebel
  • 41,826
  • 12
  • 125
  • 142
0
votes
2 answers

Can Scala macros be defined inside a class (as methods of that class)?

I need Scala macros (reify, quasiquote, macro impl) for my Scala assertions library. I want to be able to do this: object1.assertEquals(object2) // success: object1 = object2 Or like this: 3.assertEquals(1 + 1) // failure: 1 + 1 /= 3 Can Scala…
Michael Lafayette
  • 2,972
  • 3
  • 20
  • 54
0
votes
1 answer

Rails While Loop: Can't load a page

Good morning folks. In a model of mine, I created a method for displaying a row. The page wasn't working cause next and reify methods we're undefined , so I put a try on them. But the page doesn't load and is displaying this error on browser.…
Rails Coder.
  • 125
  • 1
  • 10
0
votes
1 answer

Using def-macros to capture source code

(for TL;DR, go to the bold face part) I am having a clean closed type class system with serialization (detached from POJO serialization woes). For example: trait Expr case class Const(i: Int) extends Expr case class BinOp(a: Expr, b: Expr, op: Int)…
0__
  • 66,707
  • 21
  • 171
  • 266
1
2