I found several of these beans lying on the ground in Mauritius where they had been discarded by a workman, I suppose. The longest one is about 44 cm. The pod contains small light brown seeds, each in its own compartment separated by a hard membrane. The dark brown paste surrounding each seed tastes sweet, like carob. At first I thought they were carob, but on checking online when back home I see that carob is a wrinkly bean, not smooth. Can anyone identify this bean? Sorry, don't know which tree they came from, so no leaves or bark.
I would suggest Cassia fistula, but you're alive, so maybe that's not the right ID. I'm being a little over-dramatic - from Cassia Fistula Seeds: "Both the pulp and the seeds are mildly toxic, causing diarrhea, vomiting and gastrointestinal distress when consumed."There is a photo of seeds on this page: Cassia fistula - Tree - Golden Shower :: Seeds for Sale, Tree seeds, Shrub seeds, Flower seeds, Vine seeds, Herb seeds,Grass seeds, Vegetable seeds
Cassia fistula .. has the right markings on outside of the pod. .....see pic 5. in link Golden tree (Cassia fistula) | Feedipedia
You mentioned "separated by a hard membrane". I have two photos from a Cassia (no label - I didn't guess the species) showing the membranes at Cassia_HonoluluZoo_Cutler_20150128_151844 and the following photo. I also have photos of pods of Cassia abbreviata (that one's a maybe) and Cassia grandis among photos here: Search: cassia | Flickr.
Thanks so much to everybody who replied, it certainly appears to be Cassia fistula. This agrees with some photos I took at another site on the island, although no pods were present on that tree so I didn't connect them. Very grateful for your help.