# StringTheory in a Class procedure

**URL:** <https://clarionhub.com/t/stringtheory-in-a-class-procedure/6726>\
**Category:** questions\
**Tags:** stringtheory\
**Created:** [October 26, 2023, 3:09pm UTC](https://clarionhub.com/t/stringtheory-in-a-class-procedure/6726 "2023-10-26T15:09:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisBos](https://clarionhub.com/letter_avatar_proxy/v4/letter/c/e495f1/32.png) [@ChrisBos](https://clarionhub.com/u/ChrisBos)\
**Post date:** [October 26, 2023, 3:09pm UTC](https://clarionhub.com/t/stringtheory-in-a-class-procedure/6726/1 "2023-10-26T15:09:35Z")

</div>

In my hand-coded project I want to use StringTheory in a procedure of one of my Classes. How do I set this up? str StringTheory placed within the procedure is not recognized: “Illegal data type: StringTheory.” Passing the string as a parameter also failed to work.

---

<div class="post-metadata">

**Author:** ![KevinErskine](https://clarionhub.com/user_avatar/clarionhub.com/kevinerskine/32/711_2.png) [@KevinErskine](https://clarionhub.com/u/KevinErskine)\
**Post date:** [October 26, 2023, 3:31pm UTC](https://clarionhub.com/t/stringtheory-in-a-class-procedure/6726/2 "2023-10-26T15:31:19Z")

</div>

INCLUDE(‘StringTheory.inc’),ONCE

Class property  
MyString &StringTheory

.Construct  
Self.MyString &= NEW StringTheory

.Destruct  
DISPOSE(Self.MyString)

---

<div class="post-metadata">

**Author:** ![MarkGoldberg](https://clarionhub.com/user_avatar/clarionhub.com/markgoldberg/32/1511_2.png) [@MarkGoldberg](https://clarionhub.com/u/MarkGoldberg)\
**Post date:** [October 26, 2023, 4:14pm UTC](https://clarionhub.com/t/stringtheory-in-a-class-procedure/6726/3 "2023-10-26T16:14:22Z")

</div>

as Kevin said, you will need an `INCLUDE('StringTheory.inc'),ONCE`  
But let’s talk about WHERE you want the include.

If you have a property in the class, like Kevin showed  
Then you’ll want to put the include in the .INC file of your class

If you’re just using a StringTheory object as data inside of a method  
then you _can_ put the include in the .CLW (but it will also work when the include is in the .INC) as the .INC is INCLUDE()d in in the .CLW

To my knowledge this is NOT DOCUMENTED:  
 → It is important when you are INCLUD()'ing a class that has a module attribute that the INLCUDE itself appears OUTSIDE of any procedure.  
That is to say the INLCUDE needs to be at the Global Scope or a Module scope.  
Otherwise, while your program will compile, it will **CRASH** at runtime the first time you “touch” an instance of the class.

---

<div class="post-metadata">

**Author:** ![ChrisBos](https://clarionhub.com/letter_avatar_proxy/v4/letter/c/e495f1/32.png) [@ChrisBos](https://clarionhub.com/u/ChrisBos)\
**Post date:** [October 26, 2023, 7:01pm UTC](https://clarionhub.com/t/stringtheory-in-a-class-procedure/6726/4 "2023-10-26T19:01:55Z")

</div>

Thanks, each of you has been a very big help. I probably should have thought of and tried to place the Include within the Class.

---

<div class="post-metadata">

**Author:** ![Rick\_UpperPark](https://clarionhub.com/user_avatar/clarionhub.com/rick_upperpark/32/346_2.png) [@Rick\_UpperPark](https://clarionhub.com/u/Rick_UpperPark)\
**Post date:** [October 26, 2023, 8:05pm UTC](https://clarionhub.com/t/stringtheory-in-a-class-procedure/6726/5 "2023-10-26T20:05:20Z")

</div>

If this is a hand-coded projects (ie. no APP files), then you will need to set the link and DLL mode on the project.  
StringTheoryLinkMode =\> 1  
StringTheoryDLLMode =\> 0

---

<div class="post-metadata">

**Author:** ![Bruce](https://clarionhub.com/letter_avatar_proxy/v4/letter/b/ccd318/32.png) [@Bruce](https://clarionhub.com/u/Bruce)\
**Post date:** [October 27, 2023, 3:11am UTC](https://clarionhub.com/t/stringtheory-in-a-class-procedure/6726/6 "2023-10-27T03:11:53Z")

</div>

And also the ABClinkMode and ABCDllMode. See stringtheory docs for details.

---

<div class="post-metadata">

**Author:** ![CarlBarnes](https://clarionhub.com/user_avatar/clarionhub.com/carlbarnes/32/1859_2.png) [@CarlBarnes](https://clarionhub.com/u/CarlBarnes)\
**Post date:** [October 27, 2023, 2:38pm UTC](https://clarionhub.com/t/stringtheory-in-a-class-procedure/6726/7 "2023-10-27T14:38:39Z")

</div>

The below GitHub repo has 5 hand coded projects that use ST including the simplest Scratch Theory. There’s also a small class Bing Bang that lets you see inside ST, so includes it.

As you’ve been told you must get your Project Defines right; otherwise, it will compile but crash when run.

> **[GitHub - CarlTBarnes/StringTheory-Tools: StringTheory tools BigBangTheory, Scratch Theory,...](https://github.com/CarlTBarnes/StringTheory-Tools#Scratch-Theory)**
>
> StringTheory tools BigBangTheory, Scratch Theory, Split Theory and Write Theory to assist in writing, testing and debugging ST code. Similar Bang String class for non-ST.
