These are chat archives for ChaiScript/ChaiScript

28th
Nov 2016
StanEpp
@StanEpp
Nov 28 2016 12:29

@lefticus I have implemented function cascading for defining objects in chaiscript for my ECS. Currently I need to define my objects like this in chaiscript:

factory.defineObject("Diamond").addComp_TouchValue().addComp_TouchDamage().addComp_Position()

This looks ugly and confusing for many components. Is it somehow possible to write it like this:

factory.defineObject("Diamond")
.addComp_TouchValue()
.addComp_TouchDamage()
.addComp_Position()

As far as I understood it correctly chaiscript stops evaluating an expression at a line break which unfortunately forbids the upper formatting.

Jason Turner
@lefticus
Nov 28 2016 13:44
@StanEpp ChaiScript attempts to continue the expression when it can, but an unfortunate sideeffect of having optional ; at the end of a statement makes it difficult to tell where to start and stop
StanEpp
@StanEpp
Nov 28 2016 18:44

Is there maybe a possibility to define a particular character that tells the parser to append the next line to the current one or to continue the expression, e.g. :

factory.defineObject("Diamond") \
.addComp_TouchValue() \
.addComp_TouchDamage() \
.addComp_Position()

It's similar to macro definitions over multiple lines.